:root {
    --bg: #eceff1;
    --text: #263238;
    --primary: #0288d1;
    --success: #2e7d32;
    --warning: #ef6c00;
    --danger: #c62828;
    --border: #cfd8dc;
}

* { box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); margin: 0; padding: 12px; color: var(--text); }
a { text-decoration: none; }
.hidden { display: none !important; }
.hidden-file { display: none; }

.container { width: 100%; max-width: 500px; margin: 0 auto; background: #fff; padding: 16px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
header { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 2px solid var(--border); padding-bottom: 12px; margin-bottom: 16px; }
header h2 { margin: 0; font-size: 20px; color: #37474f; }
.header-actions { display: flex; gap: 8px; }

.form-row { display: flex; gap: 8px; }
.flex-1 { flex: 1; }
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 13px; font-weight: 650; margin-bottom: 6px; color: #455a64; }
input[type="text"], input[type="number"], input[type="email"], input[type="password"], select { width: 100%; padding: 14px; border: 2px solid #b0bec5; border-radius: 8px; font-size: 16px; background: #fff; outline: none; }
input:focus, select:focus { border-color: var(--primary); }

.btn { border: none; border-radius: 8px; font-weight: 700; font-size: 15px; cursor: pointer; padding: 14px; display: block; width: 100%; }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn-qr { background: #546e7a; color: #fff; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-camera { background: var(--primary); color: #fff; text-align: center; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.btn-save { background: var(--success); color: #fff; margin-top: 20px; font-size: 16px; padding: 16px; }
.btn-sync { background: var(--warning); color: #fff; border: none; border-radius: 6px; padding: 10px 14px; font-weight: 700; cursor: pointer; }
.btn-sm { background: #90a4ae; border: none; color: #fff; border-radius: 6px; padding: 8px 12px; cursor: pointer; font-size: 13px; font-weight: 700; }
.btn-nav { background: #455a64; display: flex; align-items: center; justify-content: center; }
.btn-danger { background: #e53935; }

.scan-box { background: #f1f8e9; border: 2px dashed #aed581; padding: 16px; border-radius: 8px; }
.scan-box h3 { margin: 0 0 8px; color: #2e7d32; font-size: 16px; }
.scan-box p { font-size: 13px; color: #546e7a; margin: 0 0 12px; line-height: 1.45; }
.scan-result { margin-top: 12px; font-weight: 700; color: #155724; background: #d4edda; padding: 12px; border-radius: 6px; text-align: center; border: 1px solid #c3e6cb; white-space: pre-line; }
.scan-clear { margin-top: 10px; width: 100%; text-align: center; }
.qr-reader { margin-top: 10px; border-radius: 8px; overflow: hidden; }

.quick-data { background: #fafafa; border: 1px solid #eceff1; padding: 12px; border-radius: 8px; margin-top: 20px; }
.quick-data h4 { margin: 0 0 10px; color: #546e7a; }
.quick-data input { margin-top: 10px; }
.quick-data .form-row input { margin-top: 0; }

.thumbnail-strip { display: flex; gap: 10px; margin-top: 12px; overflow-x: auto; padding: 4px 0 10px; }
.thumb-item { position: relative; flex: 0 0 88px; text-align: center; font-size: 11px; color: #546e7a; }
.thumb-item img { width: 80px; height: 80px; object-fit: cover; border-radius: 6px; border: 2px solid var(--primary); display: block; margin: 0 auto 4px; }
.thumb-remove { position: absolute; top: -5px; right: 0; width: 24px; height: 24px; border-radius: 50%; border: none; background: #c62828; color: white; font-size: 18px; line-height: 20px; cursor: pointer; }

.last-saved-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: #e8f5e9; border: 1px solid #a5d6a7; border-radius: 10px; padding: 12px; margin-top: 16px; }
.last-saved-card img { width: 105px; height: 105px; background: white; padding: 5px; border-radius: 6px; }
.last-saved-inv { font-size: 17px; font-weight: 800; margin: 6px 0; word-break: break-all; }
.last-saved-card small { color: #546e7a; line-height: 1.35; }

.queue-card { background: #fff3e0; border: 1px solid #ffe0b2; padding: 15px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 18px; font-size: 14px; }
.msg-box { margin-top: 12px; padding: 12px; border-radius: 8px; font-size: 14px; font-weight: 700; text-align: center; }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.login-card { background: #fff; padding: 24px; border-radius: 12px; width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 12px; }
.login-card h3 { margin: 0 0 10px; color: #37474f; text-align: center; }

@media (min-width: 600px) {
    body { padding: 40px 20px; }
    .container { padding: 32px; }
}
