:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --panel-soft: #f8fafc;
    --line: #dbe3ef;
    --text: #10233f;
    --muted: #5f728f;
    --brand: #2563eb;
    --brand-strong: #1d4ed8;
    --success: #0f9f6e;
    --warning: #d97706;
    --danger: #dc2626;
    --shadow: 0 12px 32px rgba(16, 35, 63, 0.08);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
}

body {
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.10), transparent 28%),
        radial-gradient(circle at top right, rgba(15, 159, 110, 0.08), transparent 22%),
        var(--bg);
    font: 14px/1.6 "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

a {
    color: inherit;
}

code {
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(16, 35, 63, 0.06);
}

.hidden {
    display: none !important;
}

.page-shell {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px 18px 40px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.topbar-kicker {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--brand);
}

.topbar h1 {
    margin: 6px 0 8px;
    font-size: 30px;
    line-height: 1.2;
}

.topbar-desc {
    margin: 0;
    max-width: 760px;
    color: var(--muted);
}

.hero-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.hero-card,
.panel {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(219, 227, 239, 0.88);
    border-radius: 18px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.hero-card {
    padding: 20px;
}

.hero-card h2,
.panel h2 {
    margin: 0 0 12px;
    font-size: 18px;
}

.status-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel-soft);
}

.status-item b {
    display: block;
    font-size: 13px;
}

.status-item span {
    color: var(--muted);
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #cbd5e1;
    flex: 0 0 auto;
}

.status-dot.pending {
    background: #94a3b8;
}

.status-dot.success {
    background: var(--success);
}

.status-dot.failed {
    background: var(--danger);
}

.status-dot.warning {
    background: var(--warning);
}

.priority-list,
.bullet-list {
    margin: 0;
    padding-left: 18px;
}

.priority-list li,
.bullet-list li {
    margin-bottom: 6px;
}

.muted {
    color: var(--muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.stat-tile {
    padding: 14px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--panel-soft);
}

.stat-tile b {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
}

.stat-tile span {
    font-size: 24px;
    font-weight: 800;
}

.stat-tile.success span {
    color: var(--success);
}

.stat-tile.failed span {
    color: var(--danger);
}

/* ── Toast 弹窗通知（右上角堆叠） ── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 420px;
}

.toast {
    position: relative;
    padding: 12px 38px 12px 16px;
    border-radius: 12px;
    border: 1px solid #fecaca;
    background: #fff1f2;
    color: #b91c1c;
    font-size: 13px;
    line-height: 1.5;
    box-shadow: 0 8px 24px rgba(16, 35, 63, 0.12);
    pointer-events: auto;
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.28s ease, transform 0.28s ease;
    word-break: break-word;
}

.toast-visible {
    opacity: 1;
    transform: translateX(0);
}

/* 退场：移除 toast-visible 后 transition 自动反向播放，
   toast-exiting 仅作为 JS 侧防重入标记，不额外添加动画 */

.toast-success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.toast-warning {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.toast-close {
    position: absolute;
    top: 0;
    right: 0;
    width: 30px;
    height: 100%;
    min-width: unset;
    border: none;
    background: transparent;
    color: inherit;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.5;
    padding: 0;
    border-radius: 0 12px 12px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.04);
}

.notice {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid #fecaca;
    background: #fff1f2;
    color: #b91c1c;
    white-space: pre-wrap;
}

.notice.success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.page-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.18fr) minmax(360px, 0.82fr);
    gap: 16px;
    align-items: start;
}

.main-column,
.side-column,
.single-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.panel {
    padding: 18px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.panel-head p {
    margin: 0;
}

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.narrow-form {
    max-width: 480px;
}

.form-grid {
    display: grid;
    gap: 12px;
}

.form-grid.two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.compact-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
}

input,
select,
textarea,
button {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    font: inherit;
    padding: 12px 14px;
    transition: all 0.2s ease;
}

textarea {
    min-height: 112px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(37, 99, 235, 0.65);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

button {
    cursor: pointer;
    font-weight: 700;
}

button.primary {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, var(--brand), var(--brand-strong));
}

button.secondary {
    background: #eef2ff;
    color: var(--brand);
    border-color: rgba(37, 99, 235, 0.18);
}

button.danger {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

button:hover {
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ── 按钮 loading 状态 ── */
button.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

button.is-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
}

button.secondary.is-loading::after {
    border-color: rgba(37, 99, 235, 0.2);
    border-top-color: var(--brand);
}

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

.inline-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.inline-actions > * {
    width: auto;
    min-width: 124px;
}

.checkbox-block {
    align-self: end;
}

.checkbox-line {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-weight: 700;
}

.checkbox-line input {
    width: 18px;
    height: 18px;
    margin: 0;
    padding: 0;
    border-radius: 6px;
}

.helper-text {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--muted);
}

.helper-link {
    margin-left: 8px;
    font-size: 11px;
    font-weight: 400;
    color: var(--brand);
    text-decoration: none;
    opacity: 0.75;
    transition: opacity 0.15s;
}

.helper-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.preview-box,
.log-console {
    margin: 0;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #0f172a;
    color: #cbd5e1;
    padding: 14px;
    font: 12px/1.6 "Consolas", "SFMono-Regular", monospace;
    white-space: pre-wrap;
    word-break: break-word;
    overflow: auto;
}

.preview-box {
    background: #f8fafc;
    color: var(--text);
    font-family: "Consolas", "SFMono-Regular", monospace;
}

.field-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 22px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    font-size: 12px;
    color: var(--muted);
}

.field-status.success {
    border-color: rgba(34, 197, 94, 0.24);
    background: #f0fdf4;
    color: #166534;
}

.field-status.warning {
    border-color: rgba(245, 158, 11, 0.24);
    background: #fffbeb;
    color: #92400e;
}

.field-status.error {
    border-color: rgba(239, 68, 68, 0.24);
    background: #fef2f2;
    color: #b91c1c;
}

.card-parse-state {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: -2px;
}

.operation-section {
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
}

.operation-section summary {
    cursor: pointer;
    list-style: none;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 800;
    color: #20324f;
    background: var(--panel-soft);
    user-select: none;
}

.operation-section summary::-webkit-details-marker {
    display: none;
}

.operation-section > summary::after {
    content: "展开";
    float: right;
    color: var(--muted);
    font-size: 12px;
}

.operation-section[open] > summary::after {
    content: "收起";
}

.operation-section-body {
    padding: 12px;
    border-top: 1px solid var(--line);
}

/* ── 结果链接卡片（inline copy） ── */
.result-links {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 14px;
}

.result-link-card {
    display: flex;
    align-items: stretch;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.result-link-label {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    padding: 0 14px;
    background: var(--brand);
}

.result-link-field {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: stretch;
}

.result-link-url {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    width: auto !important;
    padding: 0 12px !important;
    margin: 0 !important;
    font-family: "Consolas", "SFMono-Regular", "Menlo", monospace !important;
    font-size: 12.5px !important;
    line-height: 1.4 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    color: #334155 !important;
    cursor: text;
    outline: none !important;
    box-shadow: none !important;
}

.result-link-copy {
    flex-shrink: 0;
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    border-left: 1px solid #e2e8f0;
    border-radius: 0;
    background: #f8fafc;
    color: #475569;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.result-link-copy:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.result-link-copy .icon-check { display: none; }
.result-link-copy .icon-copy  { display: block; }

.result-link-copy.copied {
    background: #ecfdf5;
    color: #059669;
    border-left-color: #a7f3d0;
}

.result-link-copy.copied .icon-check { display: block; }
.result-link-copy.copied .icon-copy  { display: none; }

.task-register-result {
    margin-bottom: 14px;
}

.register-result-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.register-result-head h3 {
    margin: 0;
    font-size: 14px;
}

.register-result-head .muted {
    margin: 4px 0 0;
}

.register-result-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.register-result-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.register-result-label {
    width: 108px;
    flex-shrink: 0;
    font-size: 12px;
    color: var(--muted);
}

.register-result-row .result-link-field {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.register-result-payload {
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.register-result-payload-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.register-result-payload-head span {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
}

#registerCpaPayloadText,
#registerAuthSessionPayloadText {
    min-height: 120px;
    font-family: "Consolas", "SFMono-Regular", "Menlo", monospace;
    font-size: 12px;
    line-height: 1.4;
    resize: vertical;
}

.gate-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(8px);
}

.gate-card {
    width: min(460px, 100%);
    padding: 24px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(219, 227, 239, 0.88);
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.22);
}

.gate-eyebrow {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: var(--brand);
}

.gate-card h2 {
    margin: 8px 0 10px;
    font-size: 24px;
}

.form-message {
    margin-top: 12px;
    min-height: 22px;
    font-size: 13px;
    color: var(--muted);
}

.form-message.success {
    color: var(--success);
}

.form-message.error {
    color: var(--danger);
}

@media (max-width: 1200px) {
    .hero-grid,
    .page-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 880px) {
    .topbar {
        flex-direction: column;
    }

    .form-grid.two-columns,
    .form-grid.compact-grid {
        grid-template-columns: 1fr;
    }

    .inline-actions > * {
        width: 100%;
    }
}

/* ===== bind page template layout ===== */

.bind-shell {
    max-width: 1480px;
}

.bind-topbar {
    align-items: flex-start;
}

.bind-topbar-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

/* ── topbar 状态指示灯 ── */
.topbar-indicators {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.topbar-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    cursor: default;
}

.indicator-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
    flex-shrink: 0;
}

.indicator-dot.success { background: var(--success); }
.indicator-dot.failed  { background: var(--danger); }
.indicator-dot.pending { background: #cbd5e1; }
.indicator-dot.warning { background: var(--warning); }

.bind-logout-btn {
    width: auto;
    min-width: 156px;
}

.bind-access-gate {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(8px);
}

.bind-gate-card {
    width: min(480px, 100%);
    padding: 28px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(219, 227, 239, 0.92);
    box-shadow: 0 24px 72px rgba(15, 23, 42, 0.24);
}

.bind-gate-card h2 {
    margin: 0 0 12px;
    font-size: 24px;
}

.bind-form-block {
    margin-bottom: 14px;
}

.bind-board {
    margin-bottom: 16px;
    padding: 24px 26px;
    border-radius: 24px;
    border: 1px solid rgba(219, 227, 239, 0.92);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.bind-board-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.bind-board-title h2 {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
}

.bind-board-title p {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 15px;
}

/* ── 任务统计芯片行 ── */
.board-stats-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 22px;
}

.board-stat-chip {
    min-width: 108px;
    padding: 14px 18px;
    border-radius: 24px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.78);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
    text-align: center;
}

.board-stat-chip b {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 4px;
    font-weight: 600;
}

.board-stat-chip span {
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
}

.board-stat-chip.success span { color: var(--success); }
.board-stat-chip.failed span  { color: var(--danger); }

/* ── 任务格子网格 ── */
.board-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(20, minmax(0, 1fr));
    gap: 6px;
    min-height: 36px;
}

.board-cell {
    height: 36px;
    border-radius: 8px;
    background: #eef1f6;
    border: 1px solid rgba(219, 227, 239, 0.95);
    cursor: default;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.board-cell:hover {
    transform: scale(1.15);
    z-index: 1;
}

.board-cell.success {
    background: var(--success);
    border-color: var(--success);
}

.board-cell.failed {
    background: var(--danger);
    border-color: var(--danger);
}

.board-cell.running {
    background: #d4a853;
    border-color: #d4a853;
    animation: cell-pulse 1.8s ease-in-out infinite;
}

@keyframes cell-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}

.board-cell.warning {
    background: var(--warning);
    border-color: var(--warning);
}

/* ── 图例 ── */
.board-legend {
    display: flex;
    gap: 22px;
    flex-wrap: wrap;
    margin-top: 16px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

.legend-dot {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 6px;
    margin-right: 8px;
    vertical-align: -4px;
    background: #eef1f6;
    border: 1px solid rgba(219, 227, 239, 0.95);
}

.legend-dot.success {
    background: var(--success);
    border-color: var(--success);
}

.legend-dot.failed {
    background: var(--danger);
    border-color: var(--danger);
}

.legend-dot.running {
    background: #d4a853;
    border-color: #d4a853;
}

@media (max-width: 880px) {
    .board-grid {
        grid-template-columns: repeat(10, minmax(0, 1fr));
    }
}

.bind-page-grid {
    align-items: stretch;
}

.bind-submit-panel,
.bind-history-panel {
    height: 100%;
}

.bind-section + .bind-section {
    margin-top: 16px;
}

.bind-mode-grid {
    margin-bottom: 16px;
}

.bind-span-full {
    grid-column: 1 / -1;
}

.three-columns {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.readonly-input {
    background: #f4f7fb;
    cursor: default;
}

.bind-card-form {
    margin-top: 12px;
}

.nested-section {
    margin-bottom: 0;
}

.operation-section-body {
    padding: 14px;
    border-top: 1px solid var(--line);
}

.bind-preview-box {
    margin-top: 12px;
}

.bind-local-config {
    margin-top: 16px;
}

.bind-config-note {
    margin: 0 0 12px;
}

.task-manual-otp {
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel-soft);
}

.task-manual-otp-head {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.task-manual-otp-head h3 {
    margin: 0 0 4px;
    font-size: 16px;
}

.task-manual-otp-email {
    color: var(--brand);
    font-size: 13px;
    font-weight: 700;
    word-break: break-all;
}

.task-manual-otp-actions {
    margin-top: 24px;
}

.task-manual-otp-actions > button {
    min-width: 136px;
}

.register-account-actions {
    margin-top: 6px;
}

#startRegisterAccountBtn {
    min-width: 172px;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.16);
}

#startRegisterAccountBtn:hover {
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.22);
}

/* ── 本地配置：操作按钮与表单间距 ── */
.operation-section-body > .inline-actions {
    margin-top: 16px;
}

/* ── 输入框后紧跟的操作按钮行：与输入框保持间距、垂直居中 ── */
input + .inline-actions,
textarea + .inline-actions {
    margin-top: 10px;
    align-items: center;
}

/* ── inline-actions 内部辅助文字：重置外间距以对齐按钮 ── */
.inline-actions > .helper-text {
    margin: 0;
}

/* ── 本地配置：Session JSON / 代理 解析反馈 ── */
.parsed-info {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--panel-soft);
    font-size: 12px;
    line-height: 1.8;
    color: var(--muted);
}

.parsed-info.success {
    border-color: rgba(34, 197, 94, 0.24);
    background: #f0fdf4;
}

.parsed-info.error {
    border-color: rgba(239, 68, 68, 0.24);
    background: #fef2f2;
    color: #b91c1c;
}

.parsed-info.warning {
    border-color: rgba(217, 119, 6, 0.24);
    background: #fff7ed;
    color: #9a3412;
}

.parsed-info-row {
    display: flex;
    gap: 6px;
}

.parsed-info-label {
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    min-width: 72px;
}

.field-hint {
    margin-top: 6px;
    font-size: 12px;
    color: var(--muted);
}

.field-hint.success {
    color: var(--success);
}

.field-hint.error {
    color: var(--danger);
}

.bind-console-head {
    align-items: center;
}

.bind-console-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.bind-console-actions button {
    width: auto;
    min-width: 132px;
}

.task-console-links {
    margin-bottom: 12px;
}

/* ── 终端日志面板 ── */
.protocol-log.task-console-output {
    min-height: 460px;
    max-height: 720px;
    overflow-y: auto;
    resize: vertical;
    border-radius: 12px;
    border: 1px solid rgba(30, 41, 59, 0.25);
    background: #0f172a;
    color: #cbd5e1;
    font: 12.5px/1.7 "Consolas", "SFMono-Regular", "Menlo", "Monaco", monospace;
    padding: 14px 0;
    box-shadow:
        inset 0 2px 6px rgba(0, 0, 0, 0.25),
        0 1px 2px rgba(0, 0, 0, 0.05);
    letter-spacing: 0.01em;
    scroll-behavior: smooth;
}

/* 空状态 */
.log-empty {
    color: rgba(148, 163, 184, 0.5);
    padding: 0 18px;
    user-select: none;
}

/* 单行日志 */
.log-line {
    padding: 1px 18px;
    word-break: break-word;
    white-space: pre-wrap;
    transition: background 0.15s;
}

.log-line:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* 时间戳 */
.log-time {
    color: #64748b;
    user-select: none;
}

/* 任务标签 */
.log-tag {
    font-weight: 600;
    margin-right: 2px;
}

/* ── 日志行着色：按内容语义区分（仅字体色） ── */

/* 系统消息（蓝灰） */
.log-line--system {
    color: #94a3b8;
}
.log-line--system .log-tag { color: #60a5fa; }

/* 成功（绿） */
.log-line--success {
    color: #86efac;
}
.log-line--success .log-tag { color: #4ade80; }

/* 错误（红） */
.log-line--error {
    color: #fca5a5;
}
.log-line--error .log-tag { color: #f87171; }

/* 警告（琥珀） */
.log-line--warning {
    color: #fcd34d;
}
.log-line--warning .log-tag { color: #fbbf24; }

/* 链接类日志（青） */
.log-line--link {
    color: #67e8f9;
}
.log-line--link .log-tag { color: #22d3ee; }

@media (max-width: 1200px) {
    .bind-board-stats {
        justify-content: flex-start;
    }
}

@media (max-width: 880px) {
    .bind-topbar-actions {
        width: 100%;
        align-items: stretch;
    }

    .three-columns {
        grid-template-columns: 1fr;
    }

    .bind-console-head {
        flex-direction: column;
        align-items: stretch;
    }

    .task-manual-otp-head {
        flex-direction: column;
        align-items: stretch;
    }

    .bind-console-actions button {
        width: 100%;
    }
}

/* ===== admin page layout ===== */

.admin-shell {
    max-width: 1200px;
}

.admin-topbar h1 {
    margin: 6px 0 0;
    font-size: 26px;
}

/* ── Tab 主导航 ── */
.admin-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--line);
    margin-bottom: 20px;
}

.admin-tab {
    position: relative;
    width: auto;
    min-width: 110px;
    padding: 10px 22px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.2s;
}

.admin-tab:hover {
    color: var(--text);
    transform: none;
}

.admin-tab.active {
    color: var(--brand);
}

.admin-tab.active::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--brand);
    border-radius: 2px 2px 0 0;
}

/* ── Tab 内容面板 ── */
.admin-tab-pane {
    display: none;
}

.admin-tab-pane.active {
    display: block;
}

/* ── 系统配置：横向长卡 ── */
.admin-config-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.admin-config-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.admin-config-card {
    padding: 20px;
    display: grid;
    grid-template-columns: minmax(200px, 240px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.admin-config-card-intro {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 4px;
}

.admin-config-card h3 {
    margin: 0;
    font-size: 15px;
}

.admin-config-card-intro > .muted {
    margin: 0;
    font-size: 12px;
}

.admin-config-card-body {
    min-width: 0;
}

.admin-config-card .checkbox-block {
    align-self: stretch;
}

/* ── 密钥管理：统计行 ── */
.admin-key-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.admin-stat-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.admin-stat-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
}

.admin-stat-chip.success .admin-stat-value {
    color: var(--success);
}

.admin-stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

/* ── Master-Detail 双栏 ── */
.admin-key-master-detail {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

/* ── 左栏：密钥列表 ── */
.admin-key-list-pane {
    padding: 0;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
}

.admin-key-list-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--line);
}

.admin-key-list-head h3 {
    margin: 0;
    font-size: 15px;
}

.admin-key-list-head .inline-actions {
    gap: 6px;
}

.admin-key-list-head .inline-actions button {
    min-width: 52px;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 8px;
}

.admin-key-list-body {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}

.admin-key-empty {
    padding: 24px 16px;
    text-align: center;
    font-size: 13px;
}

/* 密钥行项 */
.admin-key-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}

.admin-key-item:hover {
    background: rgba(37, 99, 235, 0.04);
}

.admin-key-item.selected {
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.18);
}

.admin-key-item-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--success);
}

.admin-key-item-dot.disabled {
    background: #cbd5e1;
}

.admin-key-item-info {
    flex: 1;
    min-width: 0;
}

.admin-key-item-name {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-key-item-sub {
    display: block;
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-key-item-badge {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(37, 99, 235, 0.08);
    color: var(--brand);
}

/* ── 右栏：密钥详情头 ── */
.admin-key-detail-header {
    padding: 20px;
}

.admin-key-detail-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.admin-key-detail-title-row h2 {
    margin: 0;
    font-size: 18px;
}

.admin-key-detail-title-row .muted {
    margin: 4px 0 0;
    font-size: 13px;
}

.admin-key-detail-title-row .inline-actions button {
    min-width: 60px;
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 8px;
}

.admin-key-detail-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.admin-detail-stat {
    text-align: center;
    min-width: 72px;
}

.admin-detail-stat-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 2px;
}

.admin-detail-stat-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
}

.admin-detail-stat.success .admin-detail-stat-value {
    color: var(--success);
}

.admin-detail-stat.failed .admin-detail-stat-value {
    color: var(--danger);
}

/* ── 任务列表表格 ── */
.admin-task-table-panel {
    padding: 16px 20px;
    margin-top: 16px;
}

.admin-task-table-head {
    margin-bottom: 12px;
}

.admin-task-table-head h3 {
    margin: 0;
    font-size: 15px;
}

.admin-task-table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table th {
    text-align: left;
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.admin-table td {
    padding: 10px 10px;
    border-bottom: 1px solid rgba(219, 227, 239, 0.5);
    vertical-align: middle;
}

.admin-table tbody tr {
    cursor: pointer;
    transition: background 0.12s;
}

.admin-table tbody tr:hover {
    background: rgba(37, 99, 235, 0.03);
}

.admin-table tbody tr.selected {
    background: rgba(37, 99, 235, 0.06);
}

.admin-task-empty {
    padding: 20px;
    text-align: center;
    font-size: 13px;
}

.admin-task-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.admin-task-pagination-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 12px;
}

.admin-task-pagination-info strong {
    color: var(--text);
}

.admin-task-pagination-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.admin-task-pagination-nav {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 2px;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.admin-task-pagination-pages {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 2px;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: thin;
    padding: 0;
}

.admin-task-nav-btn {
    width: auto;
    min-width: 24px;
    height: 24px;
    padding: 0 4px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    font-size: 18px;
    font-weight: 600;
    flex: 0 0 auto;
    line-height: 1;
    white-space: nowrap;
}

.admin-task-page-btn {
    width: auto;
    min-width: 24px;
    height: 24px;
    padding: 0 4px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    font-weight: 600;
    flex: 0 0 auto;
    white-space: nowrap;
}

.admin-task-nav-btn:hover:not(:disabled),
.admin-task-page-btn:hover:not(:disabled) {
    background: transparent;
    color: var(--text);
    transform: none;
}

.admin-task-page-btn.active,
.admin-task-page-btn.active:hover {
    background: transparent;
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.admin-task-page-ellipsis {
    color: var(--muted);
    font-size: 12px;
    padding: 0 2px;
}

.admin-task-pagination-size {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.admin-task-pagination-size-label {
    white-space: nowrap;
}

.admin-task-pagination-size select {
    width: auto;
    min-width: 58px;
    min-height: 28px;
    padding: 2px 22px 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text);
    font-weight: 500;
}

/* 任务状态徽章 */
.admin-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    background: #f1f5f9;
    color: var(--muted);
    white-space: nowrap;
}

.admin-badge.success {
    background: #ecfdf5;
    color: #059669;
}

.admin-badge.failed {
    background: #fef2f2;
    color: #dc2626;
}

.admin-badge.running {
    background: #fffbeb;
    color: #d97706;
}

/* 表格内日志摘要 */
.admin-task-log-summary {
    display: inline-block;
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--muted);
    font-size: 12px;
    vertical-align: middle;
}

/* 表格内操作小按钮 */
.admin-table-action-btn {
    min-width: 56px;
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 6px;
}

/* ── 任务详情面板 ── */
.admin-task-detail-panel {
    padding: 16px 20px;
    margin-top: 16px;
}

.admin-task-detail-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.admin-task-detail-head h3 {
    margin: 0;
    font-size: 15px;
}

.admin-task-detail-head .muted {
    margin: 2px 0 0;
    font-size: 12px;
}

.admin-task-detail-badges {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}

/* ── 子 Tab（任务详情内） ── */
.admin-sub-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--line);
    margin-bottom: 12px;
}

.admin-sub-tab {
    width: auto;
    min-width: 80px;
    padding: 8px 16px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s;
    position: relative;
}

.admin-sub-tab:hover {
    color: var(--text);
    transform: none;
}

.admin-sub-tab.active {
    color: var(--brand);
}

.admin-sub-tab.active::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--brand);
}

.admin-sub-tab-pane {
    display: none;
}

.admin-sub-tab-pane.active {
    display: block;
}

.admin-log-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 13px;
}

.admin-log-toolbar select {
    width: auto;
    min-width: 140px;
}

/* JSON 预览 */
.admin-json-view {
    margin: 0;
    padding: 14px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #f8fafc;
    color: var(--text);
    font: 12px/1.6 "Consolas", "SFMono-Regular", monospace;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 360px;
    overflow-y: auto;
}

/* 日志终端视图（复用 bind 页日志着色体系） */
.admin-log-view {
    min-height: 200px;
    max-height: 420px;
    overflow-y: auto;
    border-radius: 10px;
    border: 1px solid rgba(30, 41, 59, 0.25);
    background: #0f172a;
    color: #cbd5e1;
    font: 12.5px/1.7 "Consolas", "SFMono-Regular", "Menlo", monospace;
    padding: 14px 0;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.25);
    scroll-behavior: smooth;
}

/* ── 模态弹窗 ── */
.admin-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(6px);
}

.admin-modal {
    width: min(560px, 100%);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(219, 227, 239, 0.9);
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.22);
    overflow: hidden;
}

.admin-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
}

.admin-modal-head h2 {
    margin: 0;
    font-size: 18px;
}

.admin-modal-close {
    width: 32px;
    min-width: unset;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-modal-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text);
    transform: none;
}

.admin-modal-body {
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.admin-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
}

.admin-modal-actions button {
    width: auto;
    min-width: 90px;
}

/* ── 响应式 ── */
@media (max-width: 1024px) {
    .admin-key-master-detail {
        grid-template-columns: 260px minmax(0, 1fr);
    }

    .admin-config-card {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

@media (max-width: 768px) {
    .admin-key-master-detail {
        grid-template-columns: 1fr;
    }

    .admin-key-list-pane {
        position: static;
        max-height: none;
    }

    .admin-config-card {
        padding: 18px;
    }

    .admin-task-pagination,
    .admin-task-pagination-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-task-pagination-nav {
        justify-content: space-between;
        width: 100%;
    }

    .admin-task-pagination-pages {
        justify-content: center;
    }

    .admin-task-pagination-size {
        justify-content: space-between;
    }
}

/* ══════════════════════════════════════════════════════════════
   暗色主题（通过 html[data-theme="dark"] 触发）
   ══════════════════════════════════════════════════════════════ */

/* ── 主题切换按钮 ── */
.theme-toggle {
    width: auto;
    min-width: unset;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel-soft);
    color: var(--muted);
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.theme-toggle:hover {
    color: var(--text);
    background: var(--panel);
    transform: none;
}

/* ── CSS 变量覆盖 ── */
[data-theme="dark"] {
    --bg: #0f1419;
    --panel: #1a2030;
    --panel-soft: #1e2738;
    --line: #2e3a4d;
    --text: #e2e8f0;
    --muted: #8b9bb5;
    --brand: #60a5fa;
    --brand-strong: #3b82f6;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
}

/* ── body 背景渐变调暗 ── */
[data-theme="dark"] body {
    background:
        radial-gradient(circle at top left, rgba(96, 165, 250, 0.06), transparent 28%),
        radial-gradient(circle at top right, rgba(52, 211, 153, 0.04), transparent 22%),
        var(--bg);
}

/* ── code 块 ── */
[data-theme="dark"] code {
    background: rgba(255, 255, 255, 0.06);
}

/* ── 表单元素 ── */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] button {
    background: var(--panel);
    color: var(--text);
    border-color: var(--line);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    border-color: rgba(96, 165, 250, 0.65);
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15);
}

[data-theme="dark"] button.primary {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, var(--brand), var(--brand-strong));
}

[data-theme="dark"] button.secondary {
    background: rgba(96, 165, 250, 0.1);
    color: var(--brand);
    border-color: rgba(96, 165, 250, 0.2);
}

[data-theme="dark"] button.danger {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

[data-theme="dark"] button.secondary.is-loading::after {
    border-color: rgba(96, 165, 250, 0.2);
    border-top-color: var(--brand);
}

/* ── 面板 / 卡片：玻璃态 ── */
[data-theme="dark"] .hero-card,
[data-theme="dark"] .panel {
    background: rgba(26, 32, 48, 0.92);
    border-color: rgba(46, 58, 77, 0.88);
}

[data-theme="dark"] .operation-section {
    background: var(--panel);
}

[data-theme="dark"] .operation-section summary {
    color: var(--text);
    background: var(--panel-soft);
}

/* ── 状态点（仅覆盖默认态和 pending 灰色，状态色通过变量自动适配） ── */
[data-theme="dark"] .status-dot {
    background: #4b5563;
}

[data-theme="dark"] .status-dot.pending {
    background: #4b5563;
}

[data-theme="dark"] .indicator-dot {
    background: #4b5563;
}

[data-theme="dark"] .indicator-dot.pending {
    background: #4b5563;
}

[data-theme="dark"] .indicator-dot.success { background: var(--success); }
[data-theme="dark"] .indicator-dot.failed  { background: var(--danger); }
[data-theme="dark"] .indicator-dot.warning { background: var(--warning); }

[data-theme="dark"] .status-dot.success { background: var(--success); }
[data-theme="dark"] .status-dot.failed  { background: var(--danger); }
[data-theme="dark"] .status-dot.warning { background: var(--warning); }

[data-theme="dark"] .admin-key-item-dot.disabled {
    background: #4b5563;
}

/* ── Toast 通知 ── */
[data-theme="dark"] .toast {
    border-color: rgba(248, 113, 113, 0.4);
    background: rgba(127, 29, 29, 0.85);
    color: #fca5a5;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .toast-success {
    border-color: rgba(52, 211, 153, 0.4);
    background: rgba(6, 78, 59, 0.85);
    color: #86efac;
}

[data-theme="dark"] .toast-warning {
    border-color: rgba(251, 191, 36, 0.4);
    background: rgba(120, 53, 15, 0.85);
    color: #fde68a;
}

[data-theme="dark"] .toast-close:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* ── notice 块 ── */
[data-theme="dark"] .notice {
    border-color: rgba(248, 113, 113, 0.3);
    background: rgba(127, 29, 29, 0.3);
    color: #fca5a5;
}

[data-theme="dark"] .notice.success {
    border-color: rgba(52, 211, 153, 0.3);
    background: rgba(6, 78, 59, 0.3);
    color: #86efac;
}

/* ── field-status 状态徽章 ── */
[data-theme="dark"] .field-status {
    background: var(--panel);
}

[data-theme="dark"] .field-status.success {
    border-color: rgba(52, 211, 153, 0.3);
    background: rgba(6, 78, 59, 0.25);
    color: #86efac;
}

[data-theme="dark"] .field-status.warning {
    border-color: rgba(251, 191, 36, 0.3);
    background: rgba(120, 53, 15, 0.25);
    color: #fde68a;
}

[data-theme="dark"] .field-status.error {
    border-color: rgba(248, 113, 113, 0.3);
    background: rgba(127, 29, 29, 0.25);
    color: #fca5a5;
}

/* ── parsed-info 解析反馈 ── */
[data-theme="dark"] .parsed-info.warning {
    border-color: rgba(251, 191, 36, 0.3);
    background: rgba(120, 53, 15, 0.25);
    color: #fde68a;
}
[data-theme="dark"] .parsed-info.success {
    border-color: rgba(52, 211, 153, 0.3);
    background: rgba(6, 78, 59, 0.2);
}

[data-theme="dark"] .parsed-info.error {
    border-color: rgba(248, 113, 113, 0.3);
    background: rgba(127, 29, 29, 0.2);
    color: #fca5a5;
}

/* ── preview-box（覆盖亮色背景） ── */
[data-theme="dark"] .preview-box {
    background: var(--panel-soft);
    color: var(--text);
}

/* ── 终端日志面板：暗色模式下天然契合，无需改动 ── */

/* ── readonly-input ── */
[data-theme="dark"] .readonly-input {
    background: var(--panel-soft);
}

/* ── 结果链接卡片 ── */
[data-theme="dark"] .result-link-card {
    background: var(--panel);
    border-color: var(--line);
}

[data-theme="dark"] .result-link-label {
    color: #fff;
}

[data-theme="dark"] .result-link-url {
    color: var(--text) !important;
}

[data-theme="dark"] .result-link-copy {
    background: var(--panel-soft);
    color: var(--muted);
    border-left-color: var(--line);
}

[data-theme="dark"] .result-link-copy:hover {
    background: #2a3548;
    color: var(--text);
}

[data-theme="dark"] .result-link-copy.copied {
    background: rgba(6, 78, 59, 0.3);
    color: #34d399;
    border-left-color: rgba(52, 211, 153, 0.3);
}

[data-theme="dark"] .register-result-card {
    background: var(--panel);
    border-color: var(--line);
}

[data-theme="dark"] .register-result-label,
[data-theme="dark"] .register-result-cpa-head span {
    color: var(--muted);
}

[data-theme="dark"] .register-result-row .result-link-field {
    border-color: var(--line);
}

[data-theme="dark"] #registerCpaPayloadText {
    background: var(--panel-soft);
    color: var(--text);
    border-color: var(--line);
}

/* ── 门禁遮罩 / 弹窗 ── */
[data-theme="dark"] .gate-backdrop,
[data-theme="dark"] .bind-access-gate,
[data-theme="dark"] .admin-modal-backdrop {
    background: rgba(0, 0, 0, 0.62);
}

[data-theme="dark"] .gate-card,
[data-theme="dark"] .bind-gate-card {
    background: rgba(26, 32, 48, 0.97);
    border-color: rgba(46, 58, 77, 0.88);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .admin-modal {
    background: rgba(26, 32, 48, 0.98);
    border-color: rgba(46, 58, 77, 0.9);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .admin-modal-close:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* ── bind-board 面板 ── */
[data-theme="dark"] .bind-board {
    background: rgba(26, 32, 48, 0.92);
    border-color: rgba(46, 58, 77, 0.92);
}

/* ── 统计芯片 ── */
[data-theme="dark"] .board-stat-chip {
    background: rgba(30, 39, 56, 0.78);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ── 棋盘格子 ── */
[data-theme="dark"] .board-cell {
    background: #252d3d;
    border-color: rgba(46, 58, 77, 0.8);
}

[data-theme="dark"] .board-cell.success {
    background: var(--success);
    border-color: var(--success);
}

[data-theme="dark"] .board-cell.failed {
    background: var(--danger);
    border-color: var(--danger);
}

[data-theme="dark"] .board-cell.running {
    background: #d4a853;
    border-color: #d4a853;
}

[data-theme="dark"] .board-cell.warning {
    background: var(--warning);
    border-color: var(--warning);
}

[data-theme="dark"] .legend-dot {
    background: #252d3d;
    border-color: rgba(46, 58, 77, 0.8);
}

[data-theme="dark"] .legend-dot.success {
    background: var(--success);
    border-color: var(--success);
}

[data-theme="dark"] .legend-dot.failed {
    background: var(--danger);
    border-color: var(--danger);
}

[data-theme="dark"] .legend-dot.running {
    background: #d4a853;
    border-color: #d4a853;
}

/* ── admin 表格 ── */
[data-theme="dark"] .admin-table td {
    border-bottom-color: rgba(46, 58, 77, 0.5);
}

[data-theme="dark"] .admin-table tbody tr:hover {
    background: rgba(96, 165, 250, 0.05);
}

[data-theme="dark"] .admin-table tbody tr.selected {
    background: rgba(96, 165, 250, 0.1);
}

/* ── admin 密钥列表 ── */
[data-theme="dark"] .admin-key-item:hover {
    background: rgba(96, 165, 250, 0.06);
}

[data-theme="dark"] .admin-key-item.selected {
    background: rgba(96, 165, 250, 0.12);
    border-color: rgba(96, 165, 250, 0.22);
}

[data-theme="dark"] .admin-key-item-badge {
    background: rgba(96, 165, 250, 0.12);
}

/* ── admin 状态徽章 ── */
[data-theme="dark"] .admin-badge {
    background: var(--panel-soft);
}

[data-theme="dark"] .admin-badge.success {
    background: rgba(6, 78, 59, 0.3);
    color: #34d399;
}

[data-theme="dark"] .admin-badge.failed {
    background: rgba(127, 29, 29, 0.3);
    color: #f87171;
}

[data-theme="dark"] .admin-badge.running {
    background: rgba(120, 53, 15, 0.3);
    color: #fbbf24;
}

/* ── admin JSON 预览 ── */
[data-theme="dark"] .admin-json-view {
    background: var(--panel-soft);
}
