/* 联盟蜘蛛 - 商用版样式 */
:root {
    --primary: #00d4aa;
    --primary-dark: #00b894;
    --danger: #dc3545;
    --warning: #ffc107;
    --bg: #f0f2f5;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.08);
    --radius: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: #333;
    line-height: 1.6;
}

.header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 56px;
}

.logo { font-size: 18px; font-weight: bold; color: var(--primary); text-decoration: none; }
.nav { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.nav a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    white-space: nowrap;
}
.nav a:hover, .nav a.active { background: rgba(255,255,255,0.1); color: white; }

.user-info { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.user-info .points {
    background: rgba(0,212,170,0.2);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: bold;
}
.user-info a { color: rgba(255,255,255,0.7); text-decoration: none; font-size: 13px; }
.notif-bell { position: relative; cursor: pointer; padding: 4px 8px; }
.notif-badge {
    position: absolute; top: -2px; right: 0;
    background: var(--danger); color: white;
    font-size: 10px; min-width: 16px; height: 16px;
    border-radius: 8px; text-align: center; line-height: 16px;
}

.main { max-width: 1400px; margin: 0 auto; padding: 20px; }

.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    margin-bottom: 20px;
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.card-header h2 { font-size: 16px; }
.card-body { padding: 20px; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}
.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #666;
    font-size: 13px;
}
.data-table tr:hover { background: #f8f9fa; }
.data-table .text-right { text-align: right; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #e9ecef; color: #495057; }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn:disabled, .btn.loading { opacity: 0.65; cursor: not-allowed; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; color: #555; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,212,170,0.15);
}
.form-hint { display: block; margin-top: 6px; color: #888; font-size: 13px; }
.password-field-wrap { position: relative; }
.password-field-wrap .password-input { padding-right: 44px; }
.password-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    padding: 0;
}
.password-toggle:hover { color: var(--primary); background: rgba(0,212,170,.08); }
.password-toggle svg { width: 20px; height: 20px; }
.password-toggle .icon-eye-closed { display: none; }
.password-toggle.is-visible .icon-eye-open { display: none; }
.password-toggle.is-visible .icon-eye-closed { display: block; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; }

.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 20px; font-size: 14px; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }

.announcement-bar {
    background: linear-gradient(90deg, #fff3cd, #ffeeba);
    color: #856404;
    padding: 10px 20px;
    text-align: center;
    font-size: 14px;
    border-bottom: 1px solid #ffc107;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}
.stat-card {
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
}
.stat-card .label { font-size: 13px; color: #888; }
.stat-card .value { font-size: 24px; font-weight: bold; margin-top: 4px; }
.stat-card .value.primary { color: var(--primary); }
.stat-card .value.danger { color: var(--danger); }

.tabs { display: flex; gap: 5px; border-bottom: 1px solid #eee; padding: 0 20px; overflow-x: auto; }
.tab {
    padding: 12px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-content { display: none; padding: 20px; }
.tab-content.active { display: block; }

.pagination { display: flex; gap: 5px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.page-btn, .page-link {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
}
.page-btn.active, .page-link.active { background: var(--primary); color: white; border-color: var(--primary); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-info { background: #d1ecf1; color: #0c5460; }

.nav-badge {
    display: inline-block;
    min-width: 18px;
    padding: 1px 6px;
    border-radius: 10px;
    background: var(--warning);
    color: #333;
    font-size: 11px;
    font-weight: bold;
    margin-left: 4px;
}

.task-url-wrap { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.task-url-input { border: 1px solid #ddd; border-radius: 4px; background: #f8f9fa; font-size: 12px; }

.progress-wrap { margin: 10px 0; }
.progress-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 4px;
    transition: width 0.3s;
}
.progress-label { font-size: 12px; color: #888; margin-top: 4px; }

.pool-card {
    border: 1px solid #eee;
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.2s;
}
.pool-card:hover { border-color: var(--primary); }
.pool-card.disabled { opacity: 0.5; cursor: not-allowed; }
.pool-card .pool-desc { font-size: 12px; color: #888; margin-top: 4px; }

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: #999;
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: white;
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.modal-header { padding: 16px 20px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 20px; }
.modal-footer { padding: 15px 20px; border-top: 1px solid #eee; display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #999; }

.todo-overdue { border-left: 4px solid var(--danger) !important; background: #fff5f5 !important; }

#toast-container {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease;
    max-width: 320px;
}
.toast-success { background: #28a745; }
.toast-error { background: var(--danger); }
.toast-info { background: #17a2b8; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.chart-box { height: 280px; margin-bottom: 20px; }

.mobile-cards { display: none; }
.mobile-card {
    background: #f8f9fa;
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
    border: 1px solid #eee;
}
.mobile-card .row { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 13px; }
.mobile-card .label { color: #888; }

.notif-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 200;
}
.notif-dropdown.active { display: block; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid #eee; font-size: 13px; }
.notif-item.unread { background: #f0fdf9; }
.notif-item a { color: inherit; text-decoration: none; }

.section-tip {
    padding: 14px 18px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #f0fdf9 0%, #ecfeff 100%);
    border: 1px solid #99f6e4;
    border-radius: var(--radius);
    font-size: 14px;
    color: #0f766e;
    line-height: 1.6;
}
.section-tip-meta { display: block; margin-top: 6px; color: #64748b; font-size: 13px; }

.portal-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}
.portal-search-input {
    padding: 8px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    min-width: 200px;
}
.portal-search-input:focus {
    outline: none;
    border-color: var(--accent, #06b6d4);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.12);
}
.stat-card-clickable { cursor: pointer; transition: box-shadow .2s, transform .2s; }
.stat-card-clickable:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); transform: translateY(-1px); }
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #94a3b8;
    font-size: 15px;
    background: #f8fafc;
    border-radius: var(--radius);
    border: 1px dashed #e2e8f0;
}
.pool-list-box {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    padding: 12px;
    background: #fafafa;
}
.pool-list-box .pool-card { display: block; padding: 8px 10px; margin-bottom: 6px; border-radius: 6px; cursor: pointer; }
.pool-list-box .pool-card:hover { background: #f0fdf9; }
.checkbox-inline { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.stat-card-highlight { border: 1px solid rgba(0,212,170,0.35); background: linear-gradient(135deg, #fff 0%, #f0fdf9 100%); }
.customer-welcome { margin-bottom: 20px; }
.tabs .tab { transition: background .2s, color .2s; }
.tabs .tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.agent-pricing-panel .pricing-hero {
    padding: 24px 28px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f0f9ff, #f8fafc);
    border: 1px solid #e2e8f0;
    margin-bottom: 24px;
}
.agent-pricing-panel .pricing-hero h2 { margin-bottom: 8px; }
.agent-pricing-panel .pricing-example {
    margin-top: 12px;
    padding: 12px 16px;
    background: #fff;
    border-radius: 8px;
    font-size: 14px;
    color: #475569;
    border-left: 4px solid var(--primary);
}
.agent-pricing-panel .markup-form { margin-bottom: 28px; }
.agent-pricing-panel .align-end { align-items: flex-end; }
.agent-preview-block {
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px dashed #cbd5e1;
    overflow: visible;
}
.agent-recharge-editor-wrap .agent-recharge-editor {
    padding: 24px;
    background: linear-gradient(160deg, #f0f9ff 0%, #f8fafc 40%, #f1f5f9 100%);
    overflow: visible;
}
.recharge-card-editor {
    cursor: default;
}
.recharge-card-editor:hover {
    transform: translateY(-4px);
}
.recharge-edit-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 72px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid #fcd34d;
    background: #fffbeb;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}
.recharge-edit-label {
    display: block;
    width: 100%;
    margin-bottom: 12px;
    padding: 6px 8px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-align: center;
    background: #f8fafc;
}
.recharge-edit-price-wrap {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 2px;
}
.recharge-edit-price {
    width: 120px;
    border: none;
    border-bottom: 2px dashed var(--portal-accent, #06b6d4);
    background: transparent;
    font-size: 36px;
    font-weight: 800;
    color: #0f172a;
    text-align: center;
    padding: 0 4px;
}
.recharge-edit-price:focus {
    outline: none;
    border-bottom-color: #0891b2;
}
.recharge-edit-note {
    margin-top: 10px;
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.4;
}
.agent-client-preview-block {
    margin-top: 28px;
    padding: 24px;
    background: linear-gradient(160deg, #f0f9ff 0%, #f8fafc 40%, #f1f5f9 100%);
    border: 2px solid var(--portal-accent, #06b6d4);
    overflow: visible;
}
.agent-client-preview-block h3 {
    margin-bottom: 4px;
}
/* 套餐设置页：避免外层 card 裁切预览内容 */
.card.card-agent-pricing {
    overflow: visible;
}
.card.card-agent-pricing > .tab-content.active,
.card.card-agent-pricing .agent-pricing-panel,
.card.card-agent-pricing .agent-preview-block,
.card.card-agent-pricing .agent-recharge-editor-wrap {
    overflow: visible;
}
.agent-recharge-editor-wrap .recharge-card-editor {
    overflow: visible;
}
.agent-client-recharge-preview {
    width: 100%;
    overflow: visible;
    padding-bottom: 8px;
}
.agent-client-recharge-preview .mock-customer-shell {
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    overflow: visible;
}
.agent-client-recharge-preview .mock-customer-shell-inner {
    padding: 20px 24px 28px;
    overflow: visible;
}
.agent-client-recharge-preview .recharge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin: 8px 0 24px;
    width: 100%;
}
.agent-client-recharge-preview .recharge-card {
    overflow: visible;
    min-height: 0;
}
.agent-client-recharge-preview .recharge-card:hover {
    transform: translateY(-4px);
}
.agent-client-recharge-preview .recharge-contact-box {
    margin-top: 8px;
    margin-bottom: 0;
    padding: 24px 28px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--portal-accent-soft, #ecfeff), #f0fdf4);
    border: 1px solid rgba(6, 182, 212, 0.2);
    text-align: center;
}
.agent-client-recharge-preview .recharge-contact-box h3 {
    font-size: 18px;
    margin-bottom: 8px;
}
.agent-client-recharge-preview .recharge-contact-box p {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 12px;
}
.agent-client-recharge-preview .contact-val {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    word-break: break-word;
    white-space: pre-wrap;
}
.agent-pricing-hint {
    font-size: 14px;
    color: #64748b;
    margin: 0 0 16px;
    line-height: 1.6;
}
.agent-client-preview-block .agent-pricing-hint {
    margin-bottom: 12px;
}
/* 代理端充值卡片：与客户端 portal-customer.css 对齐，确保售价/积分可见 */
.agent-recharge-editor-wrap .recharge-card,
.agent-client-recharge-preview .recharge-card,
.agent-portal-preview .recharge-card {
    position: relative;
    padding: 28px 22px 24px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    text-align: center;
    transition: transform .25s, box-shadow .25s, border-color .25s;
    overflow: visible;
    min-height: 180px;
}
.agent-recharge-editor-wrap .recharge-card::before,
.agent-client-recharge-preview .recharge-card::before,
.agent-portal-preview .recharge-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--portal-accent, #06b6d4), #818cf8);
    border-radius: 16px 16px 0 0;
}
.agent-recharge-editor-wrap .recharge-card.featured,
.agent-client-recharge-preview .recharge-card.featured,
.agent-portal-preview .recharge-card.featured {
    border-color: var(--portal-accent, #06b6d4);
    box-shadow: 0 12px 32px var(--portal-accent-soft, rgba(6, 182, 212, 0.15));
}
.agent-recharge-editor-wrap .recharge-badge,
.agent-client-recharge-preview .recharge-badge,
.agent-portal-preview .recharge-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #fff;
    z-index: 1;
}
.agent-recharge-editor-wrap .recharge-card-label,
.agent-client-recharge-preview .recharge-card-label,
.agent-portal-preview .recharge-card-label {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 8px;
    font-weight: 600;
}
.agent-recharge-editor-wrap .recharge-card .price,
.agent-client-recharge-preview .recharge-card .price,
.agent-portal-preview .recharge-card .price {
    font-size: 36px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin: 4px 0;
}
.agent-recharge-editor-wrap .recharge-card .price small,
.agent-client-recharge-preview .recharge-card .price small,
.agent-portal-preview .recharge-card .price small {
    font-size: 16px;
    font-weight: 600;
}
.agent-recharge-editor-wrap .recharge-card .points,
.agent-client-recharge-preview .recharge-card .points,
.agent-portal-preview .recharge-card .points {
    margin: 12px 0 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--portal-accent, #06b6d4);
}
.agent-recharge-editor-wrap .recharge-card .points-sub,
.agent-client-recharge-preview .recharge-card .points-sub,
.agent-portal-preview .recharge-card .points-sub {
    font-size: 12px;
    color: #64748b;
    line-height: 1.5;
}
.agent-recharge-editor-wrap .recharge-card .base-hint,
.agent-client-recharge-preview .recharge-card .base-hint,
.agent-portal-preview .recharge-card .base-hint {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 8px;
    text-decoration: line-through;
}
.agent-recharge-editor .recharge-grid-editor {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin: 0;
    width: 100%;
}
@media (max-width: 768px) {
    .agent-client-recharge-preview .recharge-grid,
    .agent-recharge-editor .recharge-grid-editor {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 480px) {
    .agent-client-recharge-preview .recharge-grid,
    .agent-recharge-editor .recharge-grid-editor {
        grid-template-columns: 1fr;
    }
}
.form-row.align-end { display: flex; flex-wrap: wrap; gap: 16px; }

@media (max-width: 768px) {
    .header-inner { flex-wrap: wrap; height: auto; padding: 10px; }
    .nav { order: 3; width: 100%; }
    .main { padding: 12px; }
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .data-table.responsive-table { display: none; }
    .mobile-cards { display: block; }
    .task-url-input { width: 100% !important; }
}
