/* ==========================================================
   代理会议仪表盘 — 视觉对齐全站设计系统
   布局：单栏卡片网格 + 可展开详情面板
   支持：深浅双主题 · 响应式 · prefers-reduced-motion
   ========================================================== */

/* ---------- 0. Design Tokens — 映射到全局 variables.css ---------- */

:root {
    --px-bg-page: var(--bg-page, #F5F7FA);
    --px-bg-surface: var(--bg-card, #FFFFFF);
    --px-bg-surface-hover: var(--neutral-50, #F9FAFB);
    --px-bg-input: var(--neutral-50, #F9FAFB);
    --px-text: var(--text-main, #1e293b);
    --px-text-secondary: var(--text-sub, #64748b);
    --px-text-muted: var(--text-muted, #94a3b8);
    --px-accent: var(--brand-primary, #6366f1);
    --px-accent-hover: var(--brand-primary-hover, #5457e5);
    --px-accent-soft: var(--brand-primary-soft, rgba(99, 102, 241, 0.12));
    --px-accent-border: var(--brand-primary-border, rgba(99, 102, 241, 0.3));
    --px-border: var(--border-color, #e2e8f0);
    --px-border-light: var(--border-light, #f1f5f9);
    --px-completed: var(--color-success, #10b981);
    --px-completed-soft: var(--color-success-soft, rgba(16, 185, 129, 0.08));
    --px-active: var(--color-info, #3b82f6);
    --px-active-soft: var(--color-info-soft, rgba(59, 130, 246, 0.08));
    --px-danger: var(--color-danger, #ef4444);
    --px-danger-soft: var(--color-danger-soft, rgba(239, 68, 68, 0.12));
    --px-warning: var(--color-warning, #f59e0b);
    --px-warning-soft: var(--color-warning-soft, rgba(245, 158, 11, 0.08));
    --px-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --px-shadow-md: 0 2px 8px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
    --px-shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
    --px-shadow-card-hover: 0 8px 32px rgba(0, 0, 0, 0.1);
    --px-radius: 8px;
    --px-radius-lg: 12px;
    --px-radius-xl: 16px;
    --px-radius-2xl: 20px;
    --px-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --px-transition-fast: 150ms var(--px-ease);
    --px-transition: 250ms var(--px-ease);
    --px-transition-smooth: 300ms var(--px-ease);
    --px-focus-ring: 0 0 0 2px var(--px-bg-surface), 0 0 0 4px var(--px-accent);
}

[data-theme="dark"] {
    --px-bg-page: #0f1117;
    --px-bg-surface: #181b24;
    --px-bg-surface-hover: #1f2330;
    --px-bg-input: #1c1f2b;
    --px-text: #e2e8f0;
    --px-text-secondary: #94a3b8;
    --px-text-muted: #64748b;
    --px-accent: #818cf8;
    --px-accent-hover: #a5b4fc;
    --px-accent-soft: rgba(129, 140, 248, 0.1);
    --px-accent-border: rgba(129, 140, 248, 0.3);
    --px-border: #2a2f3e;
    --px-border-light: #1f2330;
    --px-completed: #34d399;
    --px-completed-soft: rgba(52, 211, 153, 0.1);
    --px-active: #60a5fa;
    --px-active-soft: rgba(96, 165, 250, 0.1);
    --px-danger: #f87171;
    --px-danger-soft: rgba(248, 113, 113, 0.1);
    --px-warning: #fbbf24;
    --px-warning-soft: rgba(251, 191, 36, 0.1);
    --px-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --px-shadow-md: 0 2px 10px rgba(0, 0, 0, 0.35);
    --px-shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.4);
    --px-shadow-card-hover: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ---------- 1. Base & Typography ---------- */

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--px-bg-page);
    color: var(--px-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "tnum";
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: var(--px-accent); text-decoration: none; }
a:hover { color: var(--px-accent-hover); }

/* ---------- 2. Decorative Background ---------- */

.page-bg {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.bg-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    animation: none;
}

.bg-circle-1 {
    width: 500px;
    height: 500px;
    background: var(--px-accent-soft);
    top: -150px;
    right: -100px;
}

.bg-circle-2 {
    width: 400px;
    height: 400px;
    background: rgba(167, 139, 250, 0.15);
    bottom: -100px;
    left: -100px;
    animation-delay: -10s;
}

@keyframes bgFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -20px) scale(1.05); }
    50% { transform: translate(-20px, 30px) scale(0.95); }
    75% { transform: translate(-30px, -10px) scale(1.02); }
}

.bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    animation: none;
}

@keyframes gridMove {
    0% { background-position: 0 0; }
    100% { background-position: 40px 40px; }
}

[data-theme="dark"] .bg-circle { opacity: 0.15; }
[data-theme="dark"] .bg-grid {
    background-image:
        linear-gradient(rgba(129, 140, 248, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(129, 140, 248, 0.04) 1px, transparent 1px);
}

/* ---------- 3. Page Layout ---------- */

.proxy-page {
    position: relative;
    z-index: 1;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
    min-height: 100vh;
}

/* ---------- 4. Header ---------- */

.proxy-header {
    position: relative;
    padding: 16px 0 12px;
    margin-bottom: 8px;
}

.proxy-header .header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.proxy-header .header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.proxy-header .back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    font-size: 13px;
    color: var(--px-text-secondary);
    background: transparent;
    border-radius: var(--px-radius);
    border: none;
    transition: all var(--px-transition);
    text-decoration: none;
}

.proxy-header .back-link:hover {
    color: var(--px-accent);
    background: var(--px-accent-soft);
    transform: translateX(-2px);
}

.proxy-header .back-link svg {
    transition: transform var(--px-transition-fast);
}

.proxy-header .back-link:hover svg {
    transform: translateX(-2px);
}

.proxy-header .page-title {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 700;
    color: var(--px-text);
    letter-spacing: -0.01em;
}

.proxy-header .title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--px-radius-lg);
    background: var(--px-accent-soft);
    color: var(--px-accent);
    box-shadow: none;
    flex-shrink: 0;
}

.proxy-header .page-subtitle {
    margin: 0;
    font-size: 12px;
    color: var(--px-text-muted);
}

/* ---------- 5. Section ---------- */

.proxy-section {
    margin-bottom: 32px;
}

.proxy-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px;
    font-size: 15px;
    font-weight: 600;
    color: var(--px-text-secondary);
    letter-spacing: -0.01em;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.active {
    background: var(--px-active);
    box-shadow: 0 0 0 3px var(--px-active-soft);
    animation: statusPulse 2s ease-in-out infinite;
}

.status-dot.completed {
    background: var(--px-text-muted);
}

@keyframes statusPulse {
    0%, 100% { box-shadow: 0 0 0 3px var(--px-active-soft); }
    50% { box-shadow: 0 0 0 6px var(--px-active-soft); }
}

/* ---------- 6. Grid ---------- */

.proxy-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* ---------- 7. Card ---------- */

.proxy-card {
    background: var(--px-bg-surface);
    border-radius: var(--px-radius-xl);
    border: 1px solid var(--px-border);
    box-shadow: var(--px-shadow-sm);
    transition: all var(--px-transition);
    overflow: hidden;
}

.proxy-card:hover {
    box-shadow: var(--px-shadow-card-hover);
    transform: translateY(-2px);
    border-color: var(--px-accent-border);
}

.proxy-card.active {
    border-left: 3px solid var(--px-active);
}

.proxy-card.completed {
    opacity: 0.85;
}

.proxy-card.completed:hover {
    opacity: 1;
}

.proxy-card.expanded {
    grid-column: 1 / -1;
    border-color: var(--px-accent-border);
    box-shadow: var(--px-shadow-md);
}

.proxy-card-header {
    padding: 16px 20px 12px;
    cursor: pointer;
    transition: background var(--px-transition-fast);
}

.proxy-card-header:hover {
    background: var(--px-bg-surface-hover);
}

.proxy-card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.proxy-card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--px-text);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.proxy-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.proxy-card-status {
    font-size: 12px;
    font-weight: 500;
    color: var(--px-active);
}

.proxy-card.completed .proxy-card-status {
    color: var(--px-text-muted);
}

.proxy-card-participants {
    font-size: 12px;
    color: var(--px-text-muted);
}

.proxy-card-time {
    font-size: 12px;
    color: var(--px-text-muted);
}

/* ---------- 8. Badge ---------- */

.proxy-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--px-danger);
    color: white;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    flex-shrink: 0;
    animation: badgeBounce 0.3s var(--px-ease);
}

@keyframes badgeBounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ---------- 9. Card Actions ---------- */

.proxy-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 20px 16px;
}

/* btn-outline (scoped to proxy page) */
.proxy-card-actions .btn-outline {
    background: transparent;
    border: 1px solid var(--px-border);
    color: var(--px-text-secondary);
}

.proxy-card-actions .btn-outline:hover {
    background: var(--px-bg-surface-hover);
    border-color: var(--px-accent-border);
    color: var(--px-accent);
}

/* ---------- 10. Empty State ---------- */

.proxy-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 24px;
    text-align: center;
}

.proxy-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.proxy-empty h3 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
    color: var(--px-text);
}

.proxy-empty p {
    margin: 0;
    font-size: 14px;
    color: var(--px-text-muted);
    max-width: 320px;
    line-height: 1.6;
}

/* ---------- 11. Detail Panel ---------- */

.proxy-detail {
    padding: 0 20px 20px;
    border-top: 1px solid var(--px-border-light);
    animation: detailSlideDown 0.3s var(--px-ease);
}

@keyframes detailSlideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        max-height: 1000px;
        transform: translateY(0);
    }
}

.proxy-detail-section {
    padding: 16px 0 0;
}

.proxy-detail-section + .proxy-detail-section {
    border-top: 1px solid var(--px-border-light);
    margin-top: 8px;
}

.proxy-detail-title {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--px-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ---------- 12. Alert Row ---------- */

.proxy-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--px-radius);
    cursor: pointer;
    transition: background var(--px-transition-fast);
    margin-bottom: 6px;
}

.proxy-alert:hover {
    background: var(--px-bg-surface-hover);
}

.proxy-alert.unread {
    border-left: 3px solid var(--px-accent);
    background: var(--px-accent-soft);
}

.proxy-alert.unread:hover {
    background: rgba(99, 102, 241, 0.08);
}

.proxy-alert.read {
    opacity: 0.7;
    border-left: 3px solid transparent;
}

.proxy-alert-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.proxy-alert-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.proxy-alert-speaker {
    font-size: 13px;
    font-weight: 600;
    color: var(--px-text);
}

.proxy-alert-text {
    font-size: 13px;
    color: var(--px-text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.proxy-alert-type {
    font-size: 11px;
    font-weight: 500;
    color: var(--px-accent);
    background: var(--px-accent-soft);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: center;
}

/* ---------- 13. Topics ---------- */

.proxy-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.proxy-topic-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--px-accent);
    background: var(--px-accent-soft);
    border-radius: 12px;
    border: 1px solid var(--px-accent-border);
    transition: all var(--px-transition-fast);
}

.proxy-topic-tag:hover {
    background: rgba(99, 102, 241, 0.15);
}

/* ---------- 14. Summary ---------- */

.proxy-summary-text {
    margin: 0;
    font-size: 14px;
    color: var(--px-text-secondary);
    line-height: 1.7;
    padding: 8px 12px;
    background: var(--px-bg-surface-hover);
    border-radius: var(--px-radius);
    border-left: 3px solid var(--px-accent);
}

/* ---------- 15. Comment Section ---------- */

.proxy-comment-section {
    padding: 16px 0 0;
    border-top: 1px solid var(--px-border-light);
    margin-top: 8px;
}

.proxy-comment-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.proxy-comment-input {
    flex: 1;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--px-text);
    background: var(--px-bg-input);
    border: 1px solid var(--px-border);
    border-radius: var(--px-radius);
    outline: none;
    transition: all var(--px-transition-fast);
}

.proxy-comment-input::placeholder {
    color: var(--px-text-muted);
}

.proxy-comment-input:focus {
    border-color: var(--px-accent);
    box-shadow: 0 0 0 3px var(--px-accent-soft);
    background: var(--px-bg-surface);
}

/* ---------- 16. Briefing Overlay ---------- */

.proxy-briefing-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: overlayFadeIn 0.2s ease;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.proxy-briefing-modal {
    width: 90%;
    max-width: 680px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    background: var(--px-bg-surface);
    border-radius: var(--px-radius-2xl);
    box-shadow: var(--px-shadow-lg);
    overflow: hidden;
    animation: modalSlideUp 0.3s var(--px-ease);
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.proxy-briefing-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--px-border-light);
}

.proxy-briefing-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--px-text);
}

.proxy-briefing-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    font-size: 14px;
    color: var(--px-text);
    line-height: 1.8;
}

.proxy-briefing-body h1,
.proxy-briefing-body h2,
.proxy-briefing-body h3 {
    color: var(--px-text);
    margin-top: 20px;
    margin-bottom: 8px;
}

.proxy-briefing-body h1 { font-size: 20px; }
.proxy-briefing-body h2 { font-size: 17px; }
.proxy-briefing-body h3 { font-size: 15px; }

.proxy-briefing-body p {
    margin: 0 0 12px;
}

.proxy-briefing-body ul,
.proxy-briefing-body ol {
    padding-left: 20px;
    margin: 0 0 12px;
}

.proxy-briefing-body li {
    margin-bottom: 4px;
}

.proxy-briefing-body code {
    font-size: 13px;
    background: var(--px-bg-surface-hover);
    padding: 2px 6px;
    border-radius: 4px;
}

.proxy-briefing-body blockquote {
    margin: 0 0 12px;
    padding: 8px 16px;
    border-left: 3px solid var(--px-accent);
    background: var(--px-accent-soft);
    border-radius: 0 var(--px-radius) var(--px-radius) 0;
    color: var(--px-text-secondary);
}

.proxy-briefing-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 12px 24px;
    border-top: 1px solid var(--px-border-light);
}

.proxy-briefing-time {
    font-size: 12px;
    color: var(--px-text-muted);
}

/* ---------- 17. Toast ---------- */

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    background: var(--neutral-900, #0f172a);
    color: white;
    border-radius: var(--px-radius-lg);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--px-shadow-lg);
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s var(--px-ease);
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast-success { background: var(--px-completed); }
.toast-error { background: var(--px-danger); }

/* ---------- 18. Focus States ---------- */

.proxy-header .back-link:focus-visible,
.proxy-card-header:focus-visible,
.proxy-comment-input:focus-visible,
.proxy-alert:focus-visible {
    outline: none;
    box-shadow: var(--px-focus-ring);
}

/* ---------- 19. Responsive — Tablet ---------- */

@media (max-width: 1024px) {
    .proxy-page {
        max-width: 100%;
        padding: 0 20px;
    }
}

/* ---------- 20. Responsive — Mobile ---------- */

@media (max-width: 768px) {
    .proxy-page {
        padding: 0 16px;
    }

    .proxy-header {
        padding: 12px 0 8px;
    }

    .proxy-header .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .proxy-header .page-title {
        font-size: 18px;
    }

    .proxy-header .page-subtitle {
        display: none;
    }

    .proxy-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .proxy-card.expanded {
        grid-column: 1;
    }

    .proxy-card-header {
        padding: 14px 16px 10px;
    }

    .proxy-card-actions {
        padding: 0 16px 14px;
    }

    .proxy-detail {
        padding: 0 16px 16px;
    }

    .proxy-alert {
        padding: 8px 10px;
    }

    .proxy-empty {
        padding: 48px 16px;
    }

    .proxy-briefing-modal {
        width: 95%;
        max-height: 85vh;
        border-radius: var(--px-radius-xl);
    }

    .proxy-briefing-header {
        padding: 16px 20px;
    }

    .proxy-briefing-body {
        padding: 20px;
    }

    .proxy-briefing-footer {
        padding: 10px 20px;
    }
}

/* ---------- 21. Small Mobile ---------- */

@media (max-width: 480px) {
    .proxy-header .back-link span:last-child {
        display: none;
    }

    .proxy-header .back-link {
        padding: 8px;
    }

    .proxy-header .page-title {
        font-size: 16px;
    }

    .proxy-header .title-icon {
        width: 36px;
        height: 36px;
    }

    .proxy-card-title {
        font-size: 14px;
    }

    .proxy-card-meta {
        gap: 8px;
    }

    .proxy-comment-input-wrap {
        flex-direction: column;
    }

    .proxy-comment-input-wrap .btn {
        width: 100%;
    }
}

/* ---------- 22. Reduced Motion ---------- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
