@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-page: #fafafa;
    --bg-card: #ffffff;
    --text-main: #111827;
    --text-sub: #6b7280;
    --border-color: #e5e7eb;
    --radius-card: 16px;
    --radius-btn: 8px;
    --shadow-soft: 0 1px 3px rgba(0,0,0,0.05), 0 4px 12px rgba(0,0,0,0.03);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-page);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

body.auth-locked {
    overflow: hidden;
}

/* 极其柔和的背景光晕，不再喧宾夺主 */
.bg-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    pointer-events: none;
    z-index: 0;
}
.glow-left { top: -150px; left: -150px; background: rgba(59, 130, 246, 0.2); }
.glow-right { bottom: -150px; right: -150px; background: rgba(16, 185, 129, 0.2); }

/* 主容器：限制为1024px，让人看起来最舒服的宽度 */
.auth-shell {
    position: relative;
    z-index: 1;
    width: 100%;
    padding: 0 24px 60px;
    transition: opacity 0.4s ease;
}

body.auth-locked .auth-shell {
    opacity: 0;
    pointer-events: none;
}

.dash-container {
    max-width: 1024px;
    margin: 60px auto 0;
}

/* Header */
.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 32px;
}

.dash-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 8px 0;
}

.dash-subtitle {
    font-size: 15px;
    color: var(--text-sub);
    margin: 0;
}

.header-right {
    display: flex;
    gap: 12px;
}

.dash-btn-outline {
    background: #fff;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: var(--radius-btn);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.dash-btn-outline:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.dash-btn-text {
    background: transparent;
    border: none;
    color: var(--text-sub);
    padding: 8px 16px;
    border-radius: var(--radius-btn);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.dash-btn-text:hover {
    color: var(--text-main);
    background: rgba(0,0,0,0.03);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    padding: 24px;
    box-shadow: var(--shadow-soft);
}

.stat-title {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-main);
}
.stat-value.text-sm {
    font-size: 24px;
    margin-top: 8px;
}

.dash-top-row {
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 24px;
}

.dash-panel-share .panel-desc {
    line-height: 1.8;
}

.share-inline-examples {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    vertical-align: middle;
}

.share-inline-or {
    color: var(--text-sub);
}

.dash-panel-share .code-pill {
    display: inline-block;
    margin: 4px 0;
    white-space: nowrap;
    vertical-align: middle;
}

/* Main Stack */
.dash-stack {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.dash-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.panel-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.panel-desc {
    font-size: 13px;
    color: var(--text-sub);
    margin: 4px 0 0 0;
}

.panel-body {
    padding: 24px;
}

/* 表单 */
.dash-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-inline {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
}
.form-inline .dash-input {
    max-width: 320px;
}

.form-inline-multi {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
}
.form-inline-multi .dash-input {
    max-width: 240px;
}

.payment-note {
    display: inline-block;
    margin-top: 8px;
    font-size: 13px;
    color: #f59e0b;
    font-weight: 500;
}

.dash-input {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    padding: 12px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-main);
    box-sizing: border-box;
    transition: all 0.2s;
    background: #fff;
}
.dash-input::placeholder {
    color: #9ca3af;
}
.dash-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dash-btn-primary {
    background: var(--text-main);
    color: #fff;
    border: none;
    border-radius: var(--radius-btn);
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}
.dash-btn-primary:hover {
    background: #374151;
}

.dash-msg {
    margin: 0;
    font-size: 13px;
    min-height: 18px;
    text-align: center;
}
.is-success { color: #10b981; }
.is-error { color: #ef4444; }

.info-block-accent {
    margin-top: 0;
    background: #f8fafc;
    border-color: #dbeafe;
}

.info-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-sub);
}

.info-text + .info-text {
    margin-top: 12px;
}

/* 表格 */
.dash-table-head {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr 1fr;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr 1fr;
    padding: 16px 0;
    border-bottom: 1px solid #f3f4f6;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
}
.table-row:last-child {
    border-bottom: none;
}

.code-pill {
    background: #f3f4f6;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 13px;
    color: #374151;
}

.affiliate-detail-trigger {
    appearance: none;
    border: none;
    background: transparent;
    padding: 0;
    font: inherit;
    color: #2563eb;
    cursor: pointer;
    text-decoration: none;
}

.affiliate-detail-trigger:hover {
    color: #1d4ed8;
}

.affiliate-detail-trigger-stat {
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
}

.affiliate-detail-open {
    overflow: hidden;
}

.affiliate-detail-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.45);
    z-index: 10020;
}

.affiliate-detail-overlay.is-open {
    display: flex;
}

.affiliate-detail-modal {
    width: min(980px, 100%);
    max-height: min(80vh, 760px);
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    overflow: hidden;
}

.affiliate-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.affiliate-detail-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
}

.affiliate-detail-close {
    appearance: none;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: var(--text-main);
    border-radius: 10px;
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 22px;
    font-weight: 500;
    cursor: pointer;
    line-height: 1;
}

.affiliate-detail-close:hover {
    background: #f9fafb;
}

.affiliate-detail-body {
    padding: 20px 24px 24px;
    overflow: auto;
}

.affiliate-detail-empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--text-sub);
    font-size: 14px;
}

.affiliate-detail-grid {
    display: grid;
    gap: 16px;
    min-width: 720px;
}

.affiliate-detail-grid-head,
.affiliate-detail-grid-row {
    grid-template-columns: repeat(var(--affiliate-detail-columns, 2), minmax(120px, 1fr));
}

.affiliate-detail-grid-head {
    padding: 0 0 12px;
    border-bottom: 1px solid #e5e7eb;
    color: var(--text-sub);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.affiliate-detail-grid-wrap {
    display: flex;
    flex-direction: column;
}

.affiliate-detail-grid-row {
    padding: 14px 0;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.6;
}

.affiliate-detail-grid-row:last-child {
    border-bottom: none;
}

.delete-btn {
    background: transparent;
    color: #ef4444;
    border: none;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.2s;
}
.delete-btn:hover {
    background: #fee2e2;
}

/* 响应式 */
@media (max-width: 768px) {
    .dash-header { flex-direction: column; align-items: flex-start; gap: 16px; }
    .dash-stack { gap: 16px; }
    .dash-top-row { grid-template-columns: 1fr; gap: 16px; }
    .share-inline-examples {
        display: inline-flex;
        max-width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
    }
    
    .form-inline, .form-inline-multi {
        flex-direction: column;
        align-items: stretch;
    }
    .form-inline .dash-input, .form-inline-multi .dash-input {
        max-width: 100%;
    }

    .dash-table-head { display: none; }
    .table-row {
        display: flex;
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
        padding: 20px 0;
    }
    .table-cell {
        display: flex;
        justify-content: space-between;
        width: 100%;
        align-items: center;
    }
    .table-cell::before {
        content: attr(data-label);
        color: var(--text-sub);
        font-size: 12px;
        text-transform: uppercase;
        font-weight: 600;
    }

    .affiliate-detail-overlay {
        padding: 16px;
    }

    .affiliate-detail-head,
    .affiliate-detail-body {
        padding-left: 16px;
        padding-right: 16px;
    }
}
