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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ------- flash messages ------- */
.flash-success {
    padding: 12px 24px; background: #d4edda; color: #155724;
    border-bottom: 1px solid #c3e6cb;
    font-size: 14px; text-align: center;
}
.flash-info {
    padding: 12px 24px; background: #d1ecf1; color: #0c5460;
    border-bottom: 1px solid #bee5eb;
    font-size: 14px; text-align: center;
}
.flash-error {
    padding: 12px 24px; background: #f8d7da; color: #721c24;
    border-bottom: 1px solid #f5c6cb;
    font-size: 14px; text-align: center;
}

/* ------- test banner ------- */
.test-banner {
    background: #fff3cd; color: #856404;
    text-align: center; padding: 8px;
    font-size: 13px; border-bottom: 1px solid #ffc107;
}

/* ------- containers ------- */
.container {
    max-width: 600px;
    margin: 60px auto;
    padding: 40px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    text-align: center;
}

.dashboard-container { max-width: 900px; }
.auth-container { max-width: 400px; }

h1 { font-size: 28px; margin-bottom: 8px; }
.container > p { color: #777; margin-bottom: 30px; }

/* ------- forms ------- */
.qr-form { text-align: left; }
.qr-form label { display: block; margin-bottom: 6px; font-weight: 600; }
.qr-form input[type="text"],
.qr-form input[type="email"],
.qr-form input[type="password"],
.qr-form input[type="url"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 16px;
    margin-bottom: 16px;
    transition: border-color 0.3s;
}
.qr-form input:focus { outline: none; border-color: #5b6abf; }
.qr-form small { display: block; margin: -8px 0 16px; color: #999; font-size: 13px; }

.color-row { display: flex; gap: 12px; margin-bottom: 16px; }
.color-field { flex: 1; }
.color-field label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.color-field input[type="color"] {
    width: 100%; height: 48px; padding: 4px;
    border: 2px solid #ddd; border-radius: 10px;
    cursor: pointer; background: #fff;
}

.checkbox-label {
    display: flex; align-items: center; gap: 8px;
    font-weight: 400 !important; margin-bottom: 20px; cursor: pointer;
    font-size: 14px;
}

button[type="submit"], .btn-create {
    width: 100%; padding: 14px;
    background: #5b6abf; color: #fff;
    border: none; border-radius: 10px;
    font-size: 17px; font-weight: 600; cursor: pointer;
    transition: background 0.3s; text-decoration: none; display: inline-block;
}
button[type="submit"]:hover, .btn-create:hover { background: #4a59a8; }

.btn-link {
    display: inline-block; padding: 10px 20px;
    color: #5b6abf; text-decoration: none; font-weight: 600;
}
.btn-disabled {
    display: inline-block; padding: 12px 20px;
    background: #e9ecef; color: #888; border-radius: 10px; font-size: 14px;
}

/* ------- result block ------- */
.result { margin-top: 40px; padding-top: 30px; border-top: 1px solid #eee; }
.qr-preview { width: 220px; height: 220px; margin: 20px 0; border-radius: 12px; }
.btn-download {
    display: inline-block; padding: 12px 30px;
    background: #28a745; color: #fff;
    text-decoration: none; border-radius: 10px;
    font-weight: 600; transition: background 0.3s;
}
.btn-download:hover { background: #218838; }

.dynamic-info {
    margin-top: 16px; padding: 12px;
    background: #fff3cd; border-radius: 8px; font-size: 14px; text-align: left;
}
.dynamic-info p { margin: 4px 0; }
.dynamic-info code { background: #e9ecef; padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.btn-copy {
    padding: 4px 12px; background: #5b6abf; color: #fff;
    border: none; border-radius: 6px; font-size: 13px; cursor: pointer;
}

/* ------- auth ------- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; }
.alert-error { background: #fee; color: #c00; border: 1px solid #fcc; }
.auth-link { margin-top: 20px; text-align: center; font-size: 14px; }
.auth-link a { color: #5b6abf; text-decoration: none; font-weight: 600; }
.user-links, .guest-actions, .dashboard-actions {
    margin-top: 24px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
}

/* ------- dashboard ------- */
.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.user-info { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.btn-logout { color: #c00; text-decoration: none; font-size: 13px; }

/* ------- dashboard QR cards ------- */
.qr-cards-grid { display: flex; flex-direction: column; gap: 24px; margin-top: 24px; }

.qr-card-full {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    gap: 20px;
    padding: 20px;
    transition: box-shadow 0.2s;
}
.qr-card-full:hover { box-shadow: 0 4px 24px rgba(0,0,0,0.1); }

.qr-card-preview {
    flex-shrink: 0;
    width: 120px; height: 120px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #eee;
}
.qr-card-preview img {
    width: 100%; height: 100%;
    object-fit: contain;
    display: block;
}

.qr-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }

.qr-card-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.qr-card-code { font-size: 13px; color: #666; }
.qr-card-code strong { color: #333; font-size: 14px; }

.qr-card-url {
    font-size: 14px; color: #5b6abf;
    word-break: break-all;
    padding: 8px 12px; background: #f8f9ff;
    border-radius: 8px; border: 1px solid #e8ecf8;
}

.qr-card-redirect {
    font-size: 13px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 8px;
    padding: 8px 12px;
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap;
}
.qr-card-redirect .label { color: #795548; font-weight: 600; white-space: nowrap; }
.qr-card-redirect code {
    background: #fff; color: #333;
    padding: 3px 8px; border-radius: 4px;
    font-size: 12px; word-break: break-all;
    flex: 1;
}

.qr-card-copy {
    padding: 4px 12px; background: #5b6abf; color: #fff;
    border: none; border-radius: 6px; font-size: 12px; cursor: pointer;
    white-space: nowrap;
}
.qr-card-copy:hover { background: #4a59a8; }

.qr-card-stats { display: flex; gap: 16px; flex-wrap: wrap; }
.stat {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 8px 14px;
    text-align: center;
    min-width: 70px;
}
.stat-value { display: block; font-weight: 700; font-size: 15px; color: #333; }
.stat-label { display: block; font-size: 10px; color: #999; text-transform: uppercase; margin-top: 2px; }
.stat-expiry .stat-value { color: #c00; }

.btn-download-sm {
    display: inline-block; padding: 8px 18px;
    background: #28a745; color: #fff;
    text-decoration: none; border-radius: 8px;
    font-size: 13px; font-weight: 600; transition: background 0.2s;
    white-space: nowrap;
}
.btn-download-sm:hover { background: #218838; }
.badge { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-dynamic { background: #d4edda; color: #155724; }
.badge-static { background: #e2e3e5; color: #383d41; }
.badge-pending { background: #fff3cd; color: #856404; }
.badge-approved { background: #d4edda; color: #155724; }
.badge-rejected { background: #f8d7da; color: #721c24; }
.expiry { color: #c00; font-weight: 600; }

.qr-card-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.update-form { display: flex; gap: 8px; flex: 1; min-width: 200px; }
.update-form input { padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; flex: 1; min-width: 0; }
.update-form button, .btn-delete, .btn-approve {
    padding: 8px 16px; border: none; border-radius: 6px; font-size: 13px; cursor: pointer; font-weight: 600;
}
.update-form button { background: #5b6abf; color: #fff; }
.btn-delete { background: #fee; color: #c00; }
.btn-delete:hover { background: #fcc; }
.btn-approve { background: #28a745; color: #fff; }
.empty-state { text-align: center; padding: 60px 20px; color: #999; }

/* ------- pricing ------- */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px; margin-top: 30px;
}
.pricing-card { background: #f8f9fa; border: 1px solid #e9ecef; border-radius: 12px; padding: 24px; text-align: center; }
.pricing-card h2 { margin-bottom: 8px; }
.pricing-card .price { font-size: 32px; font-weight: 700; margin: 12px 0; }
.pricing-card .price span { font-size: 14px; color: #777; font-weight: 400; }
.pricing-card ul { list-style: none; margin-bottom: 20px; font-size: 14px; }
.pricing-card li { padding: 6px 0; border-bottom: 1px solid #eee; }

/* ------- SBP payment ------- */
.sbp-steps { margin: 20px 0; text-align: left; }
.sbp-steps p { margin: 6px 0; }
.sbp-phone {
    font-size: 26px; font-weight: 700; background: #eef1ff;
    padding: 14px; border-radius: 10px; margin: 10px 0 4px; letter-spacing: 1px;
}
.sbp-holder { color: #777; font-size: 13px; margin-bottom: 20px; }

/* ------- admin ------- */
.stats-bar {
    display: flex; gap: 24px; padding: 16px 20px;
    background: #eef1ff; border-radius: 10px; margin-bottom: 30px;
    font-weight: 600;
}

/* ------- footer ------- */
.site-footer {
    margin-top: auto; padding: 24px 0;
    background: #1a1a2e; color: #aaa; font-size: 13px;
}
.footer-inner {
    max-width: 800px; margin: 0 auto; padding: 0 20px;
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: #ccc; text-decoration: none; }
.site-footer a:hover { color: #fff; }

/* ------- legal pages ------- */
.legal-content {
    max-width: 700px; margin: 40px auto; padding: 40px;
    background: #fff; border-radius: 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.legal-content h1 { font-size: 24px; margin-bottom: 24px; }
.legal-content h2 { font-size: 18px; margin: 24px 0 8px; color: #222; }
.legal-content p, .legal-content li { font-size: 15px; color: #444; margin-bottom: 8px; line-height: 1.7; }
.legal-content ul { padding-left: 20px; margin-bottom: 12px; }

/* ------- mobile ------- */
@media (max-width: 600px) {
    .container { margin: 20px auto; padding: 20px; }
    .qr-card-full { flex-direction: column; align-items: center; text-align: center; }
    .qr-card-preview { width: 140px; height: 140px; }
    .qr-card-body { text-align: left; }
    .qr-card-stats { justify-content: center; }
    .qr-card-redirect { flex-direction: column; text-align: left; }
    .qr-card-redirect code { width: 100%; }
    .update-form { flex-direction: column; width: 100%; }
    .update-form input { width: 100%; }
    .pricing-grid { grid-template-columns: 1fr; }
}
