/* ───── Reset & Base ───── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --success: #0f9d58;
    --warning: #f9ab00;
    --danger: #ea4335;
    --bg: #f0f2f5;
    --card: #ffffff;
    --text: #202124;
    --text-secondary: #5f6368;
    --border: #dadce0;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ───── Navbar ───── */
.navbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-brand {
    font-weight: 700;
    font-size: 18px;
    color: var(--primary);
    text-decoration: none;
}
.nav-links { display: flex; align-items: center; gap: 12px; }
.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background .15s;
}
.nav-links a:hover { background: var(--bg); color: var(--text); }
.nav-user {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 4px 8px;
    background: var(--bg);
    border-radius: 12px;
}

/* ───── Main ───── */
.main { max-width: 1100px; margin: 0 auto; padding: 20px; }

/* ───── Buttons ───── */
.btn {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    transition: all .15s;
}
.btn:hover { box-shadow: var(--shadow); }
.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-lg { padding: 12px 28px; font-size: 16px; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-sm {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--card);
    cursor: pointer;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all .15s;
}
.btn-sm:hover { background: var(--bg); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

/* ───── Hero ───── */
.hero {
    position: relative;
    padding: 80px 20px;
    text-align: center;
    background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
    border-radius: 12px;
    margin-bottom: 40px;
    overflow: hidden;
}
.hero-bg {
    position: absolute;
    inset: 0;
    opacity: 0.1;
    background: radial-gradient(circle at 30% 50%, #fff 0%, transparent 50%),
                radial-gradient(circle at 70% 50%, #fff 0%, transparent 50%);
}
.hero-content { position: relative; z-index: 1; }
.hero h1 {
    font-size: 36px;
    color: #fff;
    margin-bottom: 16px;
    font-weight: 700;
    line-height: 1.3;
}
.hero-sub {
    color: rgba(255,255,255,0.85);
    font-size: 18px;
    margin-bottom: 32px;
}
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-actions .btn-outline { border-color: rgba(255,255,255,0.6); color: #fff; }
.hero-actions .btn-outline:hover { background: rgba(255,255,255,0.15); border-color: #fff; }

/* ───── Section ───── */
.section { margin-bottom: 48px; }
.section h2 {
    font-size: 24px;
    text-align: center;
    margin-bottom: 24px;
    color: var(--text);
}
.page-header { text-align: center; padding: 32px 0; }
.page-header h1 { font-size: 28px; margin-bottom: 8px; }

/* ───── Features ───── */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}
.feature-card {
    background: var(--card);
    padding: 28px 20px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
}
.feature-icon { font-size: 36px; margin-bottom: 12px; }
.feature-card h3 { font-size: 18px; margin-bottom: 8px; }
.feature-card p { color: var(--text-secondary); font-size: 14px; }

/* ───── Steps ───── */
.steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}
.step {
    text-align: center;
    background: var(--card);
    padding: 24px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 160px;
    flex: 1;
}
.step-num {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 10px;
}
.step h3 { font-size: 15px; margin-bottom: 6px; }
.step p { font-size: 13px; color: var(--text-secondary); }
.step-arrow { font-size: 24px; color: var(--text-secondary); }

/* ───── Pricing ───── */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    max-width: 960px;
    margin: 0 auto;
}
.pricing-card {
    background: var(--card);
    padding: 28px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: relative;
    display: flex;
    flex-direction: column;
}
.pricing-card.popular {
    border: 2px solid var(--primary);
    transform: scale(1.03);
}
.pricing-badge {
    background: var(--bg);
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    align-self: flex-start;
}
.popular-badge {
    background: var(--primary);
    color: #fff;
}
.pricing-card h3 { font-size: 20px; margin-bottom: 8px; }
.price { font-size: 36px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.price-symbol { font-size: 18px; }
.price-period { font-size: 14px; color: var(--text-secondary); font-weight: 400; }
.price-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }
.price-unit { color: var(--success); font-weight: 600; }
.price-features { list-style: none; margin-bottom: 20px; flex: 1; }
.price-features li::before { content: "\\2713 "; color: var(--success); }
.price-features li { padding: 4px 0; font-size: 14px; }

/* ───── Auth ───── */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}
.auth-card {
    background: var(--card);
    padding: 36px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}
.auth-card h2 { margin-bottom: 20px; text-align: center; }
.auth-link { text-align: center; margin-top: 16px; font-size: 14px; color: var(--text-secondary); }
.auth-link a { color: var(--primary); }

/* ───── Forms ───── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color .15s;
}
.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(26,115,232,0.15);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-hint {
    background: #f8f9fa;
    border-left: 3px solid var(--primary);
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 0 6px 6px 0;
    font-size: 13px;
    color: var(--text-secondary);
}
.form-hint ol { margin-left: 18px; margin-top: 6px; }
.form-hint li { margin: 3px 0; }

/* ───── Alerts ───── */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-success { background: #e6f4ea; color: #1e7e34; border: 1px solid #ceead6; }
.alert-error { background: #fce8e6; color: #c5221f; border: 1px solid #f5c6c2; }
.alert-warning { background: #fef7e0; color: #e37400; border: 1px solid #fdecc8; }

/* ───── Scan Page ───── */
.scan-page { max-width: 640px; margin: 0 auto; }
.scan-header { text-align: center; margin-bottom: 24px; }
.scan-badge {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 4px 14px;
    border-radius: 14px;
    font-size: 12px;
    margin-bottom: 12px;
}
.scan-card {
    background: var(--card);
    padding: 28px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}
.scan-tip {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 12px;
}
.scan-links {
    background: var(--card);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.scan-links h3 { font-size: 16px; margin-bottom: 12px; }
.link-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    flex-wrap: wrap;
}
.link-label { font-weight: 600; white-space: nowrap; color: var(--text-secondary); }
.link-row a, .link-row code {
    flex: 1;
    color: var(--primary);
    word-break: break-all;
    font-size: 13px;
}

/* ───── View Page ───── */
.view-page { max-width: 500px; margin: 0 auto; text-align: center; }
.view-header { margin-bottom: 24px; }
.view-header h1 { font-size: 22px; }
.view-header p { color: var(--text-secondary); font-size: 14px; }
.view-card {
    background: var(--card);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.qr-display {
    width: 280px;
    height: 280px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 2px dashed var(--border);
    border-radius: 12px;
    overflow: hidden;
}
.qr-img { width: 100%; height: 100%; object-fit: contain; }
.qr-empty {
    text-align: center;
    color: var(--text-secondary);
}
.qr-empty-icon { font-size: 48px; margin-bottom: 8px; }
.qr-empty-sub { font-size: 12px; margin-top: 4px; }
.qr-info { }
.qr-timer { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.qr-tip { font-size: 12px; color: var(--text-secondary); margin-top: 10px; }

/* ───── Dashboard ───── */
.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}
.dash-header h1 { font-size: 22px; }
.dash-user-info { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.badge-free { background: #e8f0fe; color: var(--primary); }
.badge-monthly { background: #e6f4ea; color: #1e7e34; }
.badge-pro { background: #fef7e0; color: #e37400; }
.badge-unlimited { background: #f3e8fd; color: #7c3aed; }
.badge-admin { background: #fce8e6; color: #c5221f; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }

.relay-list { display: flex; flex-direction: column; gap: 12px; }
.relay-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
}
.relay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.relay-id { font-weight: 600; font-size: 14px; font-family: monospace; }
.relay-status { font-size: 13px; font-weight: 500; }
.status-active { color: var(--success); }
.status-paused { color: var(--warning); }
.status-expired { color: var(--danger); }
.relay-links { margin-bottom: 10px; }
.relay-links .link-row { font-size: 12px; }
.relay-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.relay-footer { font-size: 12px; color: var(--text-secondary); display: flex; gap: 16px; }

/* ───── Admin ───── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--card);
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
}
.stat-num { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

.admin-tabs { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.tab-nav {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: #f8f9fa;
}
.tab-btn {
    padding: 12px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all .15s;
}
.tab-btn:hover { background: rgba(0,0,0,0.02); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; padding: 20px; }
.tab-content.active { display: block; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th { font-weight: 600; color: var(--text-secondary); font-size: 12px; text-transform: uppercase; }
.admin-table tr:hover td { background: #f8f9fa; }
.action-cell { display: flex; gap: 4px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 4px; align-items: center; }
.input-sm {
    padding: 3px 6px;
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    width: 70px;
}
select.input-sm { width: auto; }

.settings-form { max-width: 480px; }
.settings-form .form-group { display: flex; align-items: center; gap: 12px; }
.settings-form .form-group label { width: 140px; flex-shrink: 0; margin-bottom: 0; }
.settings-form .form-group input { flex: 1; }

/* ───── Buy ───── */
.buy-page { max-width: 500px; margin: 0 auto; text-align: center; }
.order-card {
    background: var(--card);
    padding: 28px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-top: 20px;
}
.order-detail { margin-bottom: 20px; }
.order-detail p { font-size: 16px; margin: 6px 0; }
.order-tip { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }

/* ───── Responsive ───── */
@media (max-width: 768px) {
    .hero h1 { font-size: 26px; }
    .hero { padding: 50px 16px; }
    .step-arrow { display: none; }
    .steps { flex-direction: column; }
    .pricing-card.popular { transform: none; }
    .dash-header { flex-direction: column; align-items: flex-start; }
    .nav-links { gap: 6px; }
    .nav-links a { font-size: 13px; padding: 4px 6px; }
    .scan-links .link-row { flex-direction: column; align-items: flex-start; }
}
