*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #f1f5f9;
    color: #1e293b;
    font-size: 14px;
    line-height: 1.5;
}

/* ── Login ── */
body.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-card {
    background: #fff;
    border-radius: 14px;
    padding: 48px 40px;
    width: 360px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.login-logo {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    text-align: center;
    margin-bottom: 36px;
}

.login-card input[type="password"] {
    width: 100%;
    height: 44px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0 16px;
    font-size: 14px;
    color: #333;
    outline: none;
    transition: border-color 0.2s;
    margin-bottom: 12px;
}

.login-card input[type="password"]:focus {
    border-color: #2563eb;
}

.login-card button {
    width: 100%;
    height: 44px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.login-card button:hover {
    background: #1d4ed8;
}

.form-error {
    font-size: 13px;
    color: #dc2626;
    margin-bottom: 10px;
}

/* ── Navbar ── */
.navbar {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-title {
    font-size: 16px;
    font-weight: 700;
}

.nav-logout {
    font-size: 13px;
    color: #64748b;
    text-decoration: none;
    padding: 6px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    transition: background 0.15s;
}

.nav-logout:hover {
    background: #f8fafc;
}

/* ── Main ── */
main {
    max-width: 960px;
    margin: 0 auto;
    padding: 28px 16px 80px;
}

.card {
    background: #fff;
    border-radius: 12px;
    padding: 28px 32px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.card h2 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 20px;
}

/* ── Alerts ── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

.alert-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

/* ── QR result after generate ── */
.qr-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.qr-result img {
    width: 200px;
    height: 200px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

/* ── Form ── */
.form-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.form-row input {
    flex: 1;
    height: 40px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0 14px;
    font-size: 14px;
    color: #333;
    outline: none;
    transition: border-color 0.2s;
}

.form-row input:focus {
    border-color: #2563eb;
}

.form-hint {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 8px;
}

/* ── Buttons ── */
.btn-primary {
    height: 40px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0 22px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-download {
    display: inline-block;
    padding: 9px 28px;
    background: #059669;
    color: #fff;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-download:hover {
    background: #047857;
}

.btn-sm {
    display: inline-block;
    padding: 4px 12px;
    background: #f1f5f9;
    color: #475569;
    border-radius: 6px;
    font-size: 12px;
    text-decoration: none;
    border: 1px solid #e2e8f0;
    transition: background 0.15s;
}

.btn-sm:hover {
    background: #e2e8f0;
}

/* ── Table ── */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th {
    text-align: left;
    padding: 10px 12px;
    background: #f8fafc;
    color: #64748b;
    font-weight: 600;
    border-bottom: 1px solid #e2e8f0;
}

td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: #fafafa;
}

.qr-thumb {
    width: 56px;
    height: 56px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    cursor: zoom-in;
    display: block;
}

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-used {
    background: #dcfce7;
    color: #16a34a;
}

.badge-new {
    background: #f1f5f9;
    color: #94a3b8;
}

/* ── Pagination ── */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    font-size: 13px;
    color: #64748b;
}

/* ── Empty ── */
.empty-hint {
    font-size: 13px;
    color: #94a3b8;
    text-align: center;
    padding: 24px 0;
}

/* ── Modal ── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 999;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
}

.modal img {
    max-width: 320px;
    max-height: 320px;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

code {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
}

/* ── Quantity input ── */
.qty-input {
    width: 80px;
    height: 40px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0 12px;
    font-size: 14px;
    color: #333;
    outline: none;
    text-align: center;
}

.qty-input:focus {
    border-color: #2563eb;
}

/* ── Batch generate result grid ── */
.gen-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.gen-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100px;
}

.gen-item img {
    width: 100px;
    height: 100px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

.gen-scene {
    font-size: 11px;
    color: #64748b;
    word-break: break-all;
    text-align: center;
}

/* ── Zip download bar ── */
.zip-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
}

.zip-label {
    font-size: 13px;
    color: #475569;
}

.zip-input {
    width: 72px;
    height: 34px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0 10px;
    font-size: 13px;
    color: #333;
    outline: none;
    text-align: center;
}

.zip-input:focus {
    border-color: #2563eb;
}

.btn-zip {
    height: 34px;
    background: #7c3aed;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-zip:hover {
    background: #6d28d9;
}
