:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --transition: 0.2s ease;
    --header-height: 64px;
}

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

html { overflow-x: hidden; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; }

/* ===== Header ===== */
.header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}
.header-logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}
.header-logo:hover { color: var(--primary-dark); }
.header-logo svg { width: 32px; height: 32px; flex-shrink: 0; }
.header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex: 1;
    min-width: 0;
}
.header-nav::-webkit-scrollbar { display: none; }
.header-nav a {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    flex-shrink: 0;
}
.header-nav a:hover, .header-nav a.active { background: var(--bg); color: var(--primary); }
.header-user {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.header-user .avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.header-user .name { font-weight: 500; font-size: 14px; }
.mobile-menu-btn { display: none; background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text); padding: 4px; flex-shrink: 0; line-height: 1; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
    border: none; cursor: pointer; transition: var(--transition); text-decoration: none;
    line-height: 1.4;
    min-height: 40px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; min-height: 32px; }
.btn-lg { padding: 14px 28px; font-size: 16px; min-height: 48px; }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-block { width: 100%; }

/* ===== Container ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; width: 100%; }
.main { flex: 1; padding: 32px 0; }

/* ===== Card ===== */
.card {
    background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 24px; margin-bottom: 20px;
}
.card-header {
    font-size: 18px; font-weight: 600; margin-bottom: 20px; padding-bottom: 12px;
    border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 8px;
}

/* ===== Form ===== */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 14px; color: var(--text-secondary); }
.form-input {
    width: 100%; padding: 10px 14px; border: 2px solid var(--border); border-radius: var(--radius-sm);
    font-size: 16px; outline: none; transition: var(--transition); background: var(--bg);
    max-width: 100%;
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.form-input.error { border-color: var(--danger); }
textarea.form-input { min-height: 100px; resize: vertical; }
.form-help { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 2px; display: none; }
select.form-input { appearance: auto; }

/* ===== Alert ===== */
.alert {
    padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px;
    word-break: break-word;
}
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ===== Table ===== */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
    padding: 0 4px;
}
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; word-break: break-word; }
th { background: var(--bg); font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
tr:hover td { background: #f8fafc; }

/* ===== Pagination ===== */
.pagination { display: flex; justify-content: center; gap: 4px; margin-top: 20px; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 8px 12px; border-radius: var(--radius-sm); font-size: 14px;
    border: 1px solid var(--border); color: var(--text); transition: var(--transition);
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; min-height: 36px;
}
.pagination a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { opacity: 0.5; pointer-events: none; }

/* ===== Badge ===== */
.badge {
    display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
}
.badge-primary { background: #e0e7ff; color: #4338ca; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-pink { background: #fce7f3; color: #9d174d; }

/* ===== Grid ===== */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ===== Flex ===== */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-center { align-items: center; justify-content: center; }
.flex-between { align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

/* ===== Auth pages ===== */
.auth-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 20px;
}
.auth-card {
    background: #fff; border-radius: 20px; padding: 40px; width: 100%; max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.auth-card h1 { text-align: center; font-size: 24px; margin-bottom: 8px; }
.auth-card .subtitle { text-align: center; color: var(--text-secondary); margin-bottom: 28px; font-size: 14px; }
.auth-card .captcha-group { display: flex; gap: 8px; }
.auth-card .captcha-group img { height: 44px; border-radius: var(--radius-sm); cursor: pointer; flex-shrink: 0; }
.auth-card .captcha-group input { flex: 1; min-width: 0; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-secondary); }

/* ===== Footer ===== */
.footer {
    background: var(--card-bg); border-top: 1px solid var(--border);
    padding: 24px; text-align: center; color: var(--text-secondary); font-size: 13px;
    margin-top: auto;
}
.footer a { color: var(--text-secondary); }
.footer a:hover { color: var(--primary); }

/* ===== Stats ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--card-bg); border-radius: var(--radius); padding: 20px;
    box-shadow: var(--shadow); text-align: center;
}
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--primary); word-break: break-word; }
.stat-card .stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ===== QR Code ===== */
.qr-item { text-align: center; }
.qr-item img { max-width: 200px; border-radius: var(--radius-sm); }
.qr-generator { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.qr-preview { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.qr-preview img { max-width: 100%; width: 280px; border-radius: var(--radius); }
.style-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.style-option-card {
    border: 2px solid var(--border); border-radius: var(--radius); padding: 12px;
    cursor: pointer; transition: var(--transition); text-align: center;
}
.style-option-card:hover, .style-option-card.active { border-color: var(--primary); background: rgba(99,102,241,0.05); }
.style-option-card .preview { width: 60px; height: 60px; margin: 0 auto 8px; border-radius: 8px; }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab { padding: 10px 16px; font-size: 14px; font-weight: 500; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: var(--transition); white-space: nowrap; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab:hover { color: var(--primary); }

/* ===== Modal ===== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
    background: #fff; border-radius: var(--radius); padding: 24px; width: 100%; max-width: 480px;
    max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
    margin: auto;
}
.modal-header { font-size: 18px; font-weight: 600; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-secondary); padding: 4px; line-height: 1; flex-shrink: 0; }

/* ===== QR Style ===== */
.gradient-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.gradient-preset { width: 36px; height: 36px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; transition: var(--transition); flex-shrink: 0; }
.gradient-preset:hover, .gradient-preset.active { border-color: var(--primary); transform: scale(1.1); }

/* ===== Links ===== */
.user-links { display: flex; flex-wrap: wrap; gap: 8px; }
.user-link-item { display: flex; align-items: center; gap: 6px; padding: 6px 14px; background: var(--bg); border-radius: 20px; font-size: 13px; }
.user-link-item .remove-link { cursor: pointer; color: var(--danger); font-size: 16px; line-height: 1; }

/* ===== Profile ===== */
.profile-header { display: flex; align-items: center; gap: 24px; margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.profile-avatar { position: relative; cursor: pointer; flex-shrink: 0; }
.profile-avatar img { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; border: 3px solid var(--primary); }
.profile-avatar .overlay { position: absolute; inset: 0; border-radius: 50%; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; opacity: 0; transition: var(--transition); }
.profile-avatar:hover .overlay { opacity: 1; }
.profile-info h2 { font-size: 22px; margin-bottom: 4px; word-break: break-word; }
.profile-info .meta { font-size: 14px; color: var(--text-secondary); }

/* ===== Admin ===== */
.admin-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; min-height: calc(100vh - var(--header-height) - 80px); }
.admin-sidebar { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 0; }
.admin-sidebar a {
    display: flex; align-items: center; gap: 10px; padding: 12px 20px; color: var(--text-secondary);
    font-size: 14px; font-weight: 500; transition: var(--transition);
}
.admin-sidebar a:hover, .admin-sidebar a.active { color: var(--primary); background: rgba(99,102,241,0.05); border-left: 3px solid var(--primary); }

/* ===== Toast ===== */
.toast {
    position: fixed; top: 20px; right: 20px; z-index: 9999; padding: 12px 20px; border-radius: var(--radius-sm);
    color: #fff; font-size: 14px; box-shadow: var(--shadow-lg); animation: slideIn .3s ease;
    max-width: calc(100vw - 40px); word-break: break-word;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== Loading ===== */
.loading { display: inline-block; width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.3); border-radius: 50%; border-top-color: #fff; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== QR Create Page ===== */
.qr-create-page .style-selector { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.qr-create-page .style-card {
    border: 2px solid var(--border); border-radius: var(--radius); padding: 16px;
    cursor: pointer; text-align: center; transition: var(--transition);
}
.qr-create-page .style-card:hover, .qr-create-page .style-card.selected { border-color: var(--primary); background: rgba(99,102,241,0.03); }
.qr-create-page .style-card .color-dots { display: flex; gap: 4px; justify-content: center; margin: 8px 0; }
.qr-create-page .style-card .color-dot { width: 16px; height: 16px; border-radius: 50%; }

/* ===== Toggle ===== */
.toggle { position: relative; display: inline-block; width: 48px; height: 26px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider { position: absolute; inset: 0; background: var(--border); border-radius: 26px; cursor: pointer; transition: var(--transition); }
.toggle .slider:before { content: ''; position: absolute; height: 20px; width: 20px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: var(--transition); }
.toggle input:checked + .slider { background: var(--primary); }
.toggle input:checked + .slider:before { transform: translateX(22px); }

/* ===== Performance ===== */
.content-visibility-auto { content-visibility: auto; contain-intrinsic-size: 1px; }

/* ===== Hidden ===== */
.hidden { display: none !important; }

/* ===== Dropdown ===== */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
    position: absolute; right: 0; top: 100%; background: var(--card-bg); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg); min-width: 180px; padding: 8px 0; z-index: 150; display: none;
}
.dropdown-menu.show { display: block; }
.dropdown-menu a { display: block; padding: 8px 16px; font-size: 14px; color: var(--text); }
.dropdown-menu a:hover { background: var(--bg); color: var(--primary); }

/* ===== Copy Group ===== */
.copy-group { display: flex; gap: 8px; }
.copy-group input { flex: 1; min-width: 0; }

/* ===== Scan Stats ===== */
.stats-table { margin-top: 16px; }
.scan-map { height: 300px; background: var(--bg); border-radius: var(--radius); margin-bottom: 16px; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); }

/* ===== Time Filter ===== */
.time-filter { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.time-filter button { padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border); background: #fff; font-size: 13px; cursor: pointer; transition: var(--transition); }
.time-filter button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-state svg { width: 80px; height: 80px; margin-bottom: 16px; opacity: 0.3; max-width: 100%; }
.empty-state p { font-size: 15px; }

/* ===== Batch Page ===== */
.batch-header { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; padding: 32px; border-radius: 16px; margin-bottom: 24px; text-align: center; }
.batch-header h1 { font-size: 28px; margin-bottom: 8px; }
.batch-header p { opacity: .8; }
.upload-area { border: 2px dashed var(--border); border-radius: 12px; padding: 60px 20px; text-align: center; cursor: pointer; transition: .2s; background: #fff; }
.upload-area:hover { border-color: var(--primary); background: rgba(99,102,241,.02); }
.upload-area .icon { font-size: 48px; margin-bottom: 16px; opacity: .5; }
.upload-area p { color: #666; margin-bottom: 8px; }
.upload-area .hint { font-size: 13px; color: #999; }
.result-card { background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 2px 12px rgba(0,0,0,.06); margin-top: 24px; }
.result-stats { display: flex; gap: 24px; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.result-stat { text-align: center; }
.result-stat .num { font-size: 28px; font-weight: 800; color: var(--primary); word-break: break-word; }
.result-stat .label { font-size: 13px; color: #666; margin-top: 4px; }
.result-list { max-height: 400px; overflow-y: auto; }
.result-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-bottom: 1px solid var(--border); }
.result-item:last-child { border-bottom: none; }
.result-item img { width: 60px; height: 60px; border-radius: 4px; flex-shrink: 0; }
.result-item .info { flex: 1; min-width: 0; }
.result-item .title { font-weight: 600; margin-bottom: 4px; word-break: break-word; }
.result-item .meta { font-size: 12px; color: #999; }
.format-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.format-tab { padding: 8px 16px; border: 2px solid var(--border); border-radius: 20px; cursor: pointer; font-size: 13px; transition: .2s; }
.format-tab:hover, .format-tab.active { border-color: var(--primary); color: var(--primary); background: rgba(99,102,241,.05); }
.format-panel { display: none; }
.format-panel.active { display: block; }
.template-card { background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 2px 12px rgba(0,0,0,.06); margin-top: 24px; }
.template-card h3 { font-size: 18px; margin-bottom: 16px; }
.example-box { background: var(--bg); padding: 16px; border-radius: 8px; font-family: monospace; font-size: 13px; overflow-x: auto; word-break: break-all; }

/* ===== Decode Page ===== */
.decode-header { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; padding: 32px; border-radius: 16px; margin-bottom: 24px; text-align: center; }
.decode-header h1 { font-size: 28px; margin-bottom: 8px; }
.decode-header p { opacity: .8; }
.decode-tabs { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.decode-tab { padding: 10px 20px; border: 2px solid var(--border); border-radius: 20px; cursor: pointer; font-size: 14px; transition: .2s; background: #fff; }
.decode-tab:hover, .decode-tab.active { border-color: var(--primary); color: var(--primary); background: rgba(99,102,241,.05); }
.decode-panel { display: none; }
.decode-panel.active { display: block; }
.upload-zone { border: 2px dashed var(--border); border-radius: 12px; padding: 60px 20px; text-align: center; cursor: pointer; transition: .2s; background: #fff; }
.upload-zone:hover { border-color: var(--primary); background: rgba(99,102,241,.02); }
.upload-zone .icon { font-size: 48px; margin-bottom: 16px; opacity: .5; }
.upload-zone p { color: #666; margin-bottom: 8px; }
.upload-zone .hint { font-size: 13px; color: #999; }
.url-input-group { display: flex; gap: 8px; margin-bottom: 16px; }
.url-input-group input { flex: 1; min-width: 0; }
.url-input-group .btn { flex-shrink: 0; }
.result-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 12px; }
.result-header h3 { margin: 0; }
.result-item { display: flex; gap: 16px; padding: 16px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; background: #fff; }
.result-item img { width: 120px; height: 120px; border-radius: 4px; object-fit: cover; background: #f5f5f5; flex-shrink: 0; }
.result-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.result-index { font-size: 12px; color: #999; margin-bottom: 4px; }
.result-text { font-family: monospace; font-size: 13px; color: #333; background: var(--bg); padding: 12px; border-radius: 6px; word-break: break-all; white-space: pre-wrap; margin-bottom: 8px; max-height: 100px; overflow-y: auto; }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .qr-generator { grid-template-columns: 1fr; }
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; }
    .admin-sidebar a { padding: 8px 12px; font-size: 13px; border-left: none; border-radius: var(--radius-sm); }
    .header-nav a { font-size: 13px; padding: 6px 10px; }
}

@media (max-width: 900px) {
    .header-nav a { font-size: 12px; padding: 5px 8px; }
}

@media (max-width: 768px) {
    html, body { overflow-x: hidden; }

    .header { padding: 0 12px; }
    .header-nav { display: none; position: absolute; top: var(--header-height); left: 0; right: 0; background: var(--card-bg); padding: 12px; box-shadow: var(--shadow-md); flex-direction: column; align-items: stretch; gap: 2px; overflow-x: visible; z-index: 99; }
    .header-nav.open { display: flex; }
    .header-nav a { padding: 10px 16px; font-size: 15px; }
    .header-nav a:hover, .header-nav a.active { background: var(--bg); }
    .mobile-menu-btn { display: block !important; }
    .header-user .name { display: none; }

    .grid-2 { grid-template-columns: 1fr; }
    .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .auth-card { padding: 24px; }
    .profile-header { flex-direction: column; text-align: center; }
    .container { padding: 0 12px; }
    .main { padding: 16px 0; }

    .card { padding: 16px; }
    .card-header { font-size: 16px; }
    .batch-header { padding: 20px 16px; }
    .batch-header h1 { font-size: 22px; }
    .decode-header { padding: 20px 16px; }
    .decode-header h1 { font-size: 22px; }
    .upload-area { padding: 40px 16px; }
    .upload-zone { padding: 40px 16px; }
    .result-item { flex-direction: column; }
    .result-item img { width: 100px; height: 100px; }
    .result-stats { gap: 16px; }
    .result-stat .num { font-size: 24px; }
    .template-card { padding: 16px; }
    .result-card { padding: 16px; }

    .style-options { grid-template-columns: 1fr 1fr; }
    .qr-generator { gap: 16px; }
    .qr-preview img { width: 220px; }

    .url-input-group { flex-direction: column; }
    .url-input-group .btn { width: 100%; }

    .modal { padding: 20px; margin: 12px; }
    .modal-overlay { padding: 12px; }

    .footer { padding: 16px; }

    .pagination a, .pagination span { padding: 6px 10px; font-size: 13px; min-width: 32px; min-height: 32px; }
    th, td { padding: 8px 8px; font-size: 13px; }

    .decode-tabs { gap: 6px; }
    .decode-tab { padding: 8px 14px; font-size: 13px; }
    .format-tabs { gap: 6px; }
    .format-tab { padding: 6px 12px; font-size: 12px; }

    .stat-card { padding: 16px; }
    .stat-card .stat-value { font-size: 24px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .style-options { grid-template-columns: 1fr 1fr; }
    .qr-preview img { width: 180px; }
    .batch-header h1 { font-size: 20px; }
    .decode-header h1 { font-size: 20px; }
    .result-item img { width: 80px; height: 80px; }
    .auth-card { padding: 20px; }
    .auth-card h1 { font-size: 20px; }
    .btn { padding: 8px 16px; font-size: 13px; min-height: 36px; }
    .btn-sm { padding: 5px 10px; font-size: 12px; min-height: 30px; }
    .form-input { font-size: 15px; padding: 8px 12px; }
}