:root {
    --accent: #007aff;
    --bg: #f2f2f7;
    --red: #ff3b30;
    --green: #28a745;
    --text-dark: #2c3e50;
    --secondary: #e5e5ea;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    flex-direction: column;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

body.mac-safari, 
body.mac-safari input, 
body.mac-safari select, 
body.mac-safari option, 
body.mac-safari button, 
body.mac-safari textarea {
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif !important;
    font-weight: 400 !important;
}

.card {
    background: #fff;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    width: 380px;
    text-align: center;
    z-index: 10;
    box-sizing: border-box;
    position: relative;
}

.app-title {
    margin: 0 0 15px 0;
    font-size: 19px;
}

#status-msg {
    position: fixed;
    top: 20px;
    color: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 100000;
    display: none;
}

.error-input {
    border-color: var(--red) !important;
    background-color: #fff9f9;
}

.error-msg {
    color: var(--red);
    font-size: 10px;
    font-weight: 600;
    margin: 4px 0 0 8px;
    display: none;
    text-transform: uppercase;
}

.hidden-input {
    display: none;
}

.field {
    text-align: left;
    margin-bottom: 12px;
    position: relative;
}

.mb-0 { margin-bottom: 0 !important; }
.mt-small { margin-top: 8px !important; }

label:not(.check-item) {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #8e8e93;
    margin: 0 0 4px 0;
    text-transform: uppercase;
    padding-left: 13px;
}

input:not([type="checkbox"]), select {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d1d6;
    border-radius: 10px;
    font-size: 15px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}

.check-area {
    padding-left: 8px;
    text-align: left;
    margin: 5px 0 0 0;
    display: flex;
    gap: 15px;
    justify-content: flex-start;
}

.check-item {
    font-size: 14px;
    color: #444;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    margin: 0;
    font-weight: 400 !important;
    text-transform: none !important;
}

.check-item input:disabled, 
.check-item input:disabled + span {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.small-text {
    font-size: 11px;
    line-height: 1.2;
}

.pass-wrapper {
    position: relative;
}

.toggle-btn {
    position: absolute;
    right: 12px;
    top: 10px;
    cursor: pointer;
    font-size: 18px;
}

.profile-section {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.profile-section select {
    flex: 1;
    background: var(--secondary);
    border: none;
    font-weight: 600;
    padding: 10px;
    border-radius: 10px;
}

.backup-group {
    flex-direction: column;
    align-items: stretch;
    margin-top: 25px;
    border-top: 1px solid #eee;
    padding-top: 20px;
    display: flex;
}

.backup-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.backup-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.backup-options {
    flex-direction: column;
    gap: 5px;
    padding-left: 2px;
}

.action-group {
    display: flex;
    gap: 8px;
    margin-top: 15px;
    height: 48px;
}

.btn {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.btn-primary { background: var(--accent); color: white; flex: 3; }
.btn-secondary { background: var(--secondary); color: var(--text-dark); flex: 1.5; font-size: 13px; }

.btn-delete { background: #fff1f0; color: var(--red); flex: 1; font-size: 18px; }
.btn-delete.confirm {
    flex: 2.5;
    font-size: 13px;
    font-weight: 800;
    background: var(--red);
    color: white;
}

.print-group { display: none; margin-top: 15px; gap: 8px; height: 48px; }
.btn-print { background: #1d1d1f; color: white; flex: 1.5; }

.print-select {
    background: #3a3a3c;
    color: white;
    border-radius: 12px;
    flex: 1.2;
    border: none;
    padding: 0 10px;
    font-weight: 600;
}

.btn-backup {
    background: var(--secondary);
    color: #3a3a3c;
    font-size: 13px;
    flex: 1;
    padding: 10px;
    height: 44px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    width: 100%;
}

#qrcode-screen {
    position: relative;
    display: none;
    margin: 20px auto;
    background: #fff;
    padding: 10px;
    border-radius: 12px;
    cursor: zoom-in;
    width: 100px;
    height: 100px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    justify-content: center;
    align-items: center;
    overflow: hidden;
    z-index: 100;
}

#qr-target canvas {
    display: block;
    width: 100px !important;
    height: 100px !important;
}

#qrcode-screen.zoom {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100dvh !important;
    background: white !important;
    z-index: 99999 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    cursor: zoom-out !important;
    margin: 0 !important;
    border-radius: 0 !important;
    padding: env(safe-area-inset-top) 20px env(safe-area-inset-bottom) 20px !important;
    box-sizing: border-box !important;
}

#qrcode-screen.zoom #qr-target {
    position: relative !important;
    width: 85vmin !important;
    height: 85vmin !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

#qrcode-screen.zoom #qr-target canvas {
    width: 100% !important;
    height: 100% !important;
}

.qr-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 3px;
    width: 22px;
    height: 22px;
    z-index: 110;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

#qrcode-screen.zoom .qr-logo {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 20% !important;
    height: 20% !important;
    padding: 2% !important;
    background: #fff !important;
}

.qr-logo svg {
    fill: var(--accent);
    width: 100%;
    height: 100%;
}

.copyright {
    margin-top: 20px;
    font-size: 9px;
    color: #8e8e93;
    text-transform: uppercase;
    font-weight: 500;
    opacity: 0;
}

.card:hover .copyright { 
    opacity: 0.6; 
}

@media screen and (max-width: 480px) {
    .mobile-fix { margin-left: -3px !important; }
    .mobile-fix .check-item { gap: 3px !important; }
    .copyright {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
}

#print-fallback-msg {
    display: none;
    text-align: center;
    padding: 50px;
    font-family: sans-serif;
    color: #333;
}

@media print {
    body { background: white !important; }
    .card, #status-msg, #qrcode-screen { display: none !important; }
    #print-fallback-msg { display: block !important; }
}