:root {
    --c-primary: #2BB4B0;
    --c-primary-dark: #1a8a87;
    --c-bg: #f5f7fa;
    --c-white: #ffffff;
    --c-text: #333333;
    --c-text-muted: #888888;
    --c-border: #e0e0e0;
    --c-danger: #e74c3c;
    --c-success: #27ae60;
    --c-warning: #f39c12;
    --c-info: #3498db;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif; background: var(--c-bg); color: var(--c-text); line-height: 1.6; font-size: 14px; }

/* ====== Portal Layout ====== */
.portal-container { min-height: 100vh; display: flex; flex-direction: column; }
.portal-header { background: var(--c-white); border-bottom: 1px solid var(--c-border); padding: 16px 32px; display: flex; align-items: center; justify-content: space-between; }
.portal-header .logo-area { display: flex; align-items: center; gap: 14px; }
.portal-header .logo-area img { height: 80px; }
.portal-header .logo-area .title { font-size: 22px; font-weight: 600; color: var(--c-primary); }
.portal-main { flex: 1; max-width: 1200px; width: 100%; margin: 0 auto; padding: 40px 24px; }
.portal-footer { background: var(--c-white); border-top: 1px solid var(--c-border); padding: 20px 32px; text-align: center; color: var(--c-text-muted); font-size: 13px; }

/* Hero section */
.hero-section { display: flex; gap: 40px; align-items: flex-start; margin-bottom: 60px; }
.hero-left { flex: 1; }
.hero-right { width: 400px; flex-shrink: 0; }
.hero-title { font-size: 28px; font-weight: 700; color: var(--c-text); margin-bottom: 8px; }
.hero-subtitle { font-size: 16px; color: var(--c-text-muted); margin-bottom: 32px; }

/* Login card */
.login-card { background: var(--c-white); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow); }
.login-card h2 { font-size: 20px; font-weight: 600; margin-bottom: 24px; text-align: center; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--c-text-muted); }
.form-input { width: 100%; padding: 10px 14px; border: 1.5px solid var(--c-border); border-radius: var(--radius); font-size: 14px; outline: none; transition: border-color .2s; }
.form-input:focus { border-color: var(--c-primary); }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 24px; border-radius: var(--radius); font-size: 14px; font-weight: 500; cursor: pointer; border: none; transition: all .2s; }
.btn-primary { background: var(--c-primary); color: white; width: 100%; }
.btn-primary:hover { background: var(--c-primary-dark); }
.btn-outline { background: transparent; border: 1.5px solid var(--c-primary); color: var(--c-primary); }
.btn-outline:hover { background: var(--c-primary); color: white; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-danger { background: var(--c-danger); color: white; }
.btn-success { background: var(--c-success); color: white; }

/* Announcements */
.announcement-list { margin-bottom: 24px; }
.announcement-item { padding: 12px 16px; border-left: 3px solid var(--c-primary); margin-bottom: 12px; background: var(--c-white); border-radius: 0 var(--radius) var(--radius) 0; }
.announcement-item .ann-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.announcement-item .ann-content { font-size: 13px; color: var(--c-text-muted); }
.announcement-item .ann-meta { font-size: 12px; color: var(--c-text-muted); margin-top: 4px; }
.announcement-item.important { border-left-color: var(--c-danger); }
.announcement-item.pinned { border-left-color: var(--c-warning); }

/* Ads carousel */
.ads-section { margin-bottom: 32px; }
.ads-carousel { position: relative; overflow: hidden; border-radius: var(--radius); height: 200px; background: var(--c-white); }
.ads-carousel .ad-slide { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .5s; }
.ads-carousel .ad-slide.active { opacity: 1; }
.ads-carousel .ad-slide img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ads-carousel .ad-indicators { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; }
.ads-carousel .ad-indicators span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.5); cursor: pointer; }
.ads-carousel .ad-indicators span.active { background: var(--c-primary); }

/* Features grid */
.section-title { font-size: 22px; font-weight: 600; text-align: center; margin-bottom: 32px; }
.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-bottom: 60px; }
.feature-card { background: var(--c-white); border-radius: var(--radius-lg); padding: 28px 24px; text-align: center; box-shadow: var(--shadow); transition: transform .2s; }
.feature-card:hover { transform: translateY(-2px); }
.feature-card .f-icon { width: 56px; height: 56px; border-radius: 50%; background: #e0f7f5; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; font-size: 24px; color: var(--c-primary); }
.feature-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.feature-card p { font-size: 13px; color: var(--c-text-muted); }

/* Pricing */
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-bottom: 60px; }
.pricing-card { background: var(--c-white); border-radius: var(--radius-lg); padding: 32px 24px; text-align: center; box-shadow: var(--shadow); border: 2px solid transparent; position: relative; }
.pricing-card.featured { border-color: var(--c-primary); transform: scale(1.03); }
.pricing-card .plan-name { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.pricing-card .plan-desc { font-size: 13px; color: var(--c-text-muted); margin-bottom: 20px; }
.pricing-card .plan-price { font-size: 36px; font-weight: 700; color: var(--c-primary); margin-bottom: 4px; }
.pricing-card .plan-price span { font-size: 14px; font-weight: 400; color: var(--c-text-muted); }
.pricing-card .plan-period { font-size: 12px; color: var(--c-text-muted); margin-bottom: 20px; }
.pricing-card .plan-modules { list-style: none; text-align: left; margin-bottom: 24px; }
.pricing-card .plan-modules li { padding: 6px 0; font-size: 13px; border-bottom: 1px solid #f0f0f0; }
.pricing-card .plan-modules li::before { content: '✓'; color: var(--c-success); margin-right: 8px; font-weight: bold; }
.pricing-badge { position: absolute; top: -12px; right: 24px; background: var(--c-warning); color: white; padding: 4px 16px; border-radius: 12px; font-size: 12px; font-weight: 600; }

/* Register */
.register-section { text-align: center; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--c-border); }
.register-section a { color: var(--c-primary); text-decoration: none; font-weight: 500; }
.register-section a:hover { text-decoration: underline; }

/* Toast */
.toast { position: fixed; top: 20px; right: 20px; padding: 12px 24px; border-radius: var(--radius); color: white; font-size: 14px; z-index: 9999; animation: slideIn .3s; }
.toast.success { background: var(--c-success); }
.toast.error { background: var(--c-danger); }
.toast.warning { background: var(--c-warning); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Admin layout */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 220px; background: #1a1f36; color: white; flex-shrink: 0; display: flex; flex-direction: column; }
.admin-sidebar .sidebar-header { padding: 20px; border-bottom: 1px solid rgba(255,255,255,.1); font-size: 16px; font-weight: 600; color: var(--c-primary); }
.admin-sidebar .nav-item { display: flex; align-items: center; gap: 10px; padding: 12px 20px; cursor: pointer; font-size: 14px; color: rgba(255,255,255,.7); transition: all .2s; border-left: 3px solid transparent; }
.admin-sidebar .nav-item:hover { background: rgba(255,255,255,.08); color: white; }
.admin-sidebar .nav-item.active { background: rgba(43,180,176,.15); color: var(--c-primary); border-left-color: var(--c-primary); }
.admin-main { flex: 1; background: var(--c-bg); overflow-y: auto; }
.admin-topbar { background: var(--c-white); padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--c-border); }
.admin-content { padding: 24px; }

/* Cards for admin */
.card { background: var(--c-white); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow); margin-bottom: 24px; }
.card h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

/* Stats row */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--c-white); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--c-primary); }
.stat-card .stat-label { font-size: 13px; color: var(--c-text-muted); margin-top: 4px; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 12px 16px; background: var(--c-bg); border-bottom: 2px solid var(--c-border); font-weight: 600; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--c-border); }
.data-table tr:hover td { background: #f8f9fb; }

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.4); z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal-box { background: var(--c-white); border-radius: var(--radius-lg); padding: 32px; width: 560px; max-height: 80vh; overflow-y: auto; box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.modal-box h3 { font-size: 18px; font-weight: 600; margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.hidden { display: none !important; }

/* Tags */
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.tag-success { background: #e6f7ee; color: var(--c-success); }
.tag-warning { background: #fef3e2; color: var(--c-warning); }
.tag-danger { background: #fde8e8; color: var(--c-danger); }
.tag-info { background: #e6f1fb; color: var(--c-info); }
.tag-muted { background: #f0f0f0; color: var(--c-text-muted); }

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 38px; height: 22px; vertical-align: middle; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #ccc; border-radius: 22px; transition: 0.3s; }
.toggle .slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s; }
.toggle input:checked + .slider { background: var(--c-primary); }
.toggle input:checked + .slider:before { transform: translateX(16px); }

/* Plan module list (可展开子功能) */
.module-section { background: var(--c-bg); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.module-section-header { display: flex; align-items: center; padding: 12px 16px; cursor: pointer; user-select: none; transition: background 0.2s; }
.module-section-header:hover { background: rgba(43, 180, 176, 0.05); }
.module-section-header .expand-icon { display: inline-block; width: 16px; margin-right: 8px; transition: transform 0.2s; color: var(--c-text-muted); }
.module-section.expanded .module-section-header .expand-icon { transform: rotate(90deg); }
.module-section-header .mod-name { flex: 1; font-weight: 500; font-size: 14px; }
.module-section-header .mod-meta { color: var(--c-text-muted); font-size: 12px; margin-right: 12px; }
.module-section-body { display: none; padding: 8px 16px 16px 44px; background: white; border-top: 1px solid var(--c-border); }
.module-section.expanded .module-section-body { display: block; }
.feature-item { display: flex; align-items: center; padding: 6px 0; font-size: 13px; color: var(--c-text-secondary); }
.feature-item input[type="checkbox"] { margin-right: 8px; }
.feature-item .feat-name { flex: 1; }
.category-group { margin-bottom: 12px; }
.category-group .cat-title { font-size: 12px; font-weight: 600; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; padding: 0 4px; }

/* Color picker */
.color-input { width: 60px; height: 36px; border: 1.5px solid var(--c-border); border-radius: var(--radius); cursor: pointer; padding: 2px; }

/* Tabs in admin */
.admin-tabs { display: flex; gap: 4px; margin-bottom: 24px; border-bottom: 2px solid var(--c-border); }
.admin-tabs .tab-btn { padding: 10px 20px; cursor: pointer; border: none; background: none; font-size: 14px; color: var(--c-text-muted); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .2s; }
.admin-tabs .tab-btn.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }

/* Responsive */
@media (max-width: 768px) {
    .hero-section { flex-direction: column; }
    .hero-right { width: 100%; }
    .features-grid, .pricing-grid { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .admin-sidebar { width: 60px; }
    .admin-sidebar .nav-item span { display: none; }
}
