:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #eff6ff;
    --success: #10b981;
    --warning: #f59e0b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #eef2f6 100%);
    color: var(--gray-800);
}

.app-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 导航栏 */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 50;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gray-800), var(--gray-600));
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}

.logo-text span {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.user-area {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--gray-50);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    border: 1px solid var(--gray-200);
}

.user-greeting {
    text-align: right;
}

.greeting-text {
    font-weight: 600;
    font-size: 0.9rem;
}

.member-badge {
    font-size: 0.7rem;
    background: var(--gray-200);
    padding: 0.2rem 0.5rem;
    border-radius: 1rem;
}

.btn-login {
    background: var(--primary);
    border: none;
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: 2rem;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
}

.btn-login:hover {
    background: var(--primary-dark);
}

/* 主内容 */
.main-content {
    flex: 1;
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 2rem;
}

/* 处理卡片 */
.processor-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 1.75rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.card-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.card-header p {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

textarea {
    width: 100%;
    min-height: 280px;
    padding: 1rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-family: 'Inter', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.options-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1rem 0;
    padding: 0.75rem 0;
    border-top: 1px solid var(--gray-100);
    border-bottom: 1px solid var(--gray-100);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    padding: 0.75rem 1.75rem;
    border-radius: 2rem;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
}

.message-area {
    margin: 1rem 0;
    font-size: 0.85rem;
    color: var(--gray-500);
}

.results-area {
    margin-top: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.result-item {
    background: var(--gray-50);
    border-left: 4px solid var(--primary);
    padding: 1rem;
    border-radius: var(--radius-lg);
}

.result-item strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.result-item small {
    display: block;
    font-size: 0.7rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* 侧边栏 */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.info-card, .plan-card, .history-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.info-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.avatar-placeholder {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.info-header-text h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.info-header-text span {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.info-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px dashed var(--gray-200);
    font-size: 0.9rem;
}

.info-label {
    color: var(--gray-500);
}

.info-value.highlight {
    color: var(--primary);
    font-weight: 700;
}

.plan-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.plan-desc {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 1rem;
}

.plan-selector {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.plan-option {
    flex: 1;
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 0.75rem 0.25rem;
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
    position: relative;
}

.plan-option.active {
    border-color: var(--primary);
    background: var(--primary-light);
}

.plan-name {
    font-size: 0.8rem;
    font-weight: 600;
}

.plan-price {
    font-size: 1.1rem;
    font-weight: 700;
}

.save-tag {
    background: var(--warning);
    font-size: 0.6rem;
    padding: 0.15rem 0.4rem;
    border-radius: 1rem;
    color: white;
    position: absolute;
    top: -8px;
    right: -8px;
}

.btn-pay {
    width: 100%;
    background: var(--success);
    border: none;
    padding: 0.75rem;
    border-radius: 2rem;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.btn-pay:hover {
    background: #0d9488;
}

.history-list {
    list-style: none;
    max-height: 180px;
    overflow-y: auto;
}

.history-list li {
    font-size: 0.75rem;
    color: var(--gray-600);
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
}

.empty-history {
    color: var(--gray-400);
    text-align: center;
    justify-content: center !important;
}

/* 弹窗 */
/* 弹窗 - 修复居中问题 */
/* 弹窗彻底居中修复 */
dialog {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none;
    background: transparent;
    width: 90%;
    max-width: 400px;
    overflow: visible;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}

.dialog-container {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    width: 100%;
    position: relative;
}

.dialog-close {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: #6b7280;
}

.dialog-body {
    padding: 2rem 1.5rem 1.5rem;
    text-align: center;
}

.dialog-body h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.dialog-desc {
    color: var(--gray-600);
    font-size: 0.9rem;
}

.qr-container {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
}

.qr-container img {
    width: 200px;
    height: 200px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.qr-hint {
    font-size: 0.7rem;
    color: var(--gray-500);
    word-break: break-all;
}

/* 响应式 */
@media (max-width: 900px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    .nav-container {
        flex-direction: column;
        text-align: center;
    }
    .user-area {
        width: 100%;
        justify-content: space-between;
    }
    .main-content {
        padding: 0 1rem;
    }
    .plan-selector {
        flex-wrap: wrap;
    }
}