* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s, color 0.2s, border-color 0.2s;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.8rem;
}

.app-container {
    max-width: 720px;
    width: 100%;
    background: #ffffff;
    border-radius: 2rem;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: background 0.3s;
}

[data-theme="dark"] .app-container {
    background: #1a1a2e;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem 0.2rem 1.2rem;
}

.app-header h1 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #1a1a2e;
}

[data-theme="dark"] .app-header h1 {
    color: #eaeef2;
}

.theme-toggle {
    background: #eef0f3;
    border: none;
    font-size: 1.4rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .theme-toggle {
    background: #2d2d44;
    color: #f5e56b;
}

.tab-nav {
    display: flex;
    padding: 0 1.2rem 0.4rem 1.2rem;
    gap: 0.3rem;
    border-bottom: 1px solid #e4e7ed;
}

[data-theme="dark"] .tab-nav {
    border-bottom-color: #3a3a55;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #6b7280;
    border-radius: 2rem 2rem 0 0;
    cursor: pointer;
    transition: 0.2s;
}

.tab-btn:hover {
    background: #eef0f3;
    color: #1a1a2e;
}

.tab-btn.active {
    background: #4a6cf7;
    color: white;
    box-shadow: 0 2px 8px rgba(74, 108, 247, 0.3);
}

[data-theme="dark"] .tab-btn {
    color: #9ca3af;
}

[data-theme="dark"] .tab-btn:hover {
    background: #2d2d44;
    color: #eaeef2;
}

[data-theme="dark"] .tab-btn.active {
    background: #4a6cf7;
    color: white;
}

.tab-content {
    padding: 1rem 1.2rem 1.2rem 1.2rem;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.card {
    background: #ffffff;
    border-radius: 1.2rem;
    padding: 1.2rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .card {
    background: #1e1e2f;
}

.password-box {
    background: #f8f9fc;
    border-radius: 1rem;
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid #d0d7de;
    margin-bottom: 1rem;
}

[data-theme="dark"] .password-box {
    background: #2a2a3f;
    border-color: #3d3d5c;
}

#passwordDisplay {
    flex: 1;
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    padding: 0.4rem 0;
    background: transparent;
    border: none;
    outline: none;
    color: #0b0b1a;
    word-break: break-all;
    min-height: 2.4rem;
}

[data-theme="dark"] #passwordDisplay {
    color: #f0f3fa;
}

.copy-btn {
    background: #eef0f3;
    border: none;
    font-size: 1.2rem;
    padding: 0.3rem 0.7rem;
    border-radius: 2rem;
    cursor: pointer;
    font-weight: 500;
    color: #1f1f3a;
    transition: 0.2s;
}

.copy-btn:hover {
    background: #d0d7de;
}

[data-theme="dark"] .copy-btn {
    background: #3a3a55;
    color: #eef0f3;
}

[data-theme="dark"] .copy-btn:hover {
    background: #50507a;
}

.length-control {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin: 0.4rem 0 0.8rem 0;
    flex-wrap: wrap;
}

.length-control label {
    font-weight: 500;
    font-size: 0.9rem;
    color: #1f1f3a;
}

[data-theme="dark"] .length-control label {
    color: #d6dceb;
}

.length-control input[type="range"] {
    flex: 1;
    min-width: 100px;
    accent-color: #4a6cf7;
    height: 5px;
    border-radius: 10px;
    background: #d0d7de;
}

[data-theme="dark"] .length-control input[type="range"] {
    background: #3d3d5c;
}

.length-value {
    font-weight: 600;
    min-width: 2.2rem;
    text-align: center;
    color: #1f1f3a;
}

[data-theme="dark"] .length-value {
    color: #eaeef2;
}

.options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    background: #f4f6fa;
    padding: 0.8rem 1rem;
    border-radius: 1rem;
    margin: 0.8rem 0;
}

[data-theme="dark"] .options {
    background: #26263b;
}

.options label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 500;
    font-size: 0.85rem;
    color: #222;
    cursor: pointer;
}

[data-theme="dark"] .options label {
    color: #d6dceb;
}

.options input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #4a6cf7;
    cursor: pointer;
}

.strength-box {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin: 0.8rem 0 1rem 0;
}

.strength-label {
    font-weight: 500;
    font-size: 0.9rem;
    color: #1f1f3a;
}

[data-theme="dark"] .strength-label {
    color: #d6dceb;
}

.strength-bar {
    flex: 1;
    height: 6px;
    background: #d0d7de;
    border-radius: 20px;
    overflow: hidden;
}

[data-theme="dark"] .strength-bar {
    background: #3d3d5c;
}

.strength-fill {
    height: 100%;
    width: 0%;
    background: #e74c3c;
    border-radius: 20px;
    transition: width 0.3s, background 0.3s;
}

.strength-text {
    font-weight: 600;
    min-width: 70px;
    text-align: right;
    font-size: 0.85rem;
    color: #1f1f3a;
}

[data-theme="dark"] .strength-text {
    color: #eaeef2;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.3rem;
}

.btn {
    background: #4a6cf7;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 3rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    flex: 1 1 auto;
    justify-content: center;
    transition: 0.2s;
    box-shadow: 0 3px 8px rgba(74, 108, 247, 0.2);
}

.btn:hover {
    background: #3b5de7;
    transform: scale(0.97);
}

.btn-secondary {
    background: #eef0f3;
    color: #1f1f3a;
    box-shadow: none;
}

[data-theme="dark"] .btn-secondary {
    background: #34344f;
    color: #eaeef2;
}

[data-theme="dark"] .btn-secondary:hover {
    background: #46466b;
}

.btn-sm {
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    flex: 0 1 auto;
}

.btn-add {
    background: #2ecc71;
    box-shadow: 0 3px 8px rgba(46, 204, 113, 0.3);
}

.btn-add:hover {
    background: #27ae60;
}

.btn-google {
    background: #4285f4;
    box-shadow: 0 3px 8px rgba(66, 133, 244, 0.3);
}

.btn-google:hover {
    background: #3367d6;
}

.btn-discord {
    background: #5865f2;
    box-shadow: 0 3px 8px rgba(88, 101, 242, 0.3);
}

.btn-discord:hover {
    background: #4752c4;
}

.btn-bio {
    background: #8e44ad;
    box-shadow: 0 3px 8px rgba(142, 68, 173, 0.3);
    font-size: 1rem;
    padding: 0.7rem 1.5rem;
}

.btn-bio:hover {
    background: #732d91;
}

.history-section {
    margin-top: 1rem;
    border-top: 1px solid #d0d7de;
    padding-top: 0.8rem;
}

[data-theme="dark"] .history-section {
    border-top-color: #3d3d5c;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.history-header h3 {
    font-size: 0.9rem;
    color: #1f1f3a;
}

[data-theme="dark"] .history-header h3 {
    color: #d6dceb;
}

.clear-history {
    background: none;
    border: none;
    color: #e74c3c;
    font-weight: 600;
    cursor: pointer;
    padding: 0.1rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
}

.clear-history:hover {
    background: #fee8e8;
}

[data-theme="dark"] .clear-history:hover {
    background: #3d2a2a;
}

.history-list {
    max-height: 110px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding-right: 0.2rem;
}

.history-item {
    background: #f4f6fa;
    padding: 0.25rem 0.7rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-family: 'Courier New', monospace;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #1a1a2e;
    word-break: break-all;
}

[data-theme="dark"] .history-item {
    background: #2a2a40;
    color: #eaeef2;
}

.history-item small {
    opacity: 0.5;
    font-family: sans-serif;
    font-size: 0.6rem;
    white-space: nowrap;
    margin-left: 0.4rem;
}

.history-empty {
    color: #888;
    font-style: italic;
    text-align: center;
    padding: 0.4rem 0;
    font-size: 0.85rem;
}

[data-theme="dark"] .history-empty {
    color: #8888aa;
}

.history-list::-webkit-scrollbar {
    width: 3px;
}
.history-list::-webkit-scrollbar-thumb {
    background: #b0b8c4;
    border-radius: 10px;
}
[data-theme="dark"] .history-list::-webkit-scrollbar-thumb {
    background: #555577;
}

.manager-card {
    min-height: 350px;
}

.lock-screen {
    text-align: center;
    padding: 1.5rem 0.5rem;
}

.lock-icon {
    font-size: 3.5rem;
    margin-bottom: 0.3rem;
}

.lock-screen h2 {
    font-size: 1.4rem;
    margin-bottom: 0.2rem;
    color: #1a1a2e;
}

[data-theme="dark"] .lock-screen h2 {
    color: #eaeef2;
}

.lock-screen p {
    color: #6b7280;
    margin-bottom: 1.2rem;
    font-size: 0.9rem;
}

[data-theme="dark"] .lock-screen p {
    color: #9ca3af;
}

.auth-providers {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 0.8rem;
}

.auth-providers .btn {
    min-width: 120px;
}

/* Google One Tap / bouton personnalisé */
#googleBtnContainer {
    display: inline-block;
    min-width: 120px;
}

.auth-divider {
    color: #6b7280;
    font-size: 0.85rem;
    margin: 0.6rem 0;
}

[data-theme="dark"] .auth-divider {
    color: #9ca3af;
}

.auth-status {
    margin-top: 0.8rem;
    font-weight: 500;
    min-height: 1.8rem;
    font-size: 0.9rem;
}

.auth-status.success {
    color: #2ecc71;
}
.auth-status.error {
    color: #e74c3c;
}
.auth-status.info {
    color: #4a6cf7;
}

.bio-status {
    margin-top: 0.4rem;
    font-size: 0.85rem;
    color: #6b7280;
}

[data-theme="dark"] .bio-status {
    color: #9ca3af;
}

.bio-enroll {
    margin-top: 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

#enrollStatus {
    font-size: 0.8rem;
    color: #6b7280;
}

[data-theme="dark"] #enrollStatus {
    color: #9ca3af;
}

.password-manager {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.manager-header h3 {
    font-size: 1.1rem;
    color: #1a1a2e;
}

[data-theme="dark"] .manager-header h3 {
    color: #eaeef2;
}

.manager-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.user-display {
    font-size: 0.8rem;
    color: #4a6cf7;
    font-weight: 500;
}

[data-theme="dark"] .user-display {
    color: #7a9cf7;
}

.add-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.add-form input {
    flex: 1 1 120px;
    padding: 0.5rem 0.8rem;
    border: 1px solid #d0d7de;
    border-radius: 2rem;
    font-size: 0.85rem;
    background: #f8f9fc;
    color: #1a1a2e;
    outline: none;
}

[data-theme="dark"] .add-form input {
    background: #2a2a3f;
    border-color: #3d3d5c;
    color: #eaeef2;
}

.add-form input:focus {
    border-color: #4a6cf7;
    box-shadow: 0 0 0 2px rgba(74, 108, 247, 0.2);
}

.password-input-wrapper {
    display: flex;
    flex: 1 1 120px;
    align-items: center;
    position: relative;
}

.password-input-wrapper input {
    flex: 1;
    padding-right: 2.4rem;
}

.toggle-pass-btn {
    position: absolute;
    right: 0.4rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.2rem;
    opacity: 0.6;
}

.toggle-pass-btn:hover {
    opacity: 1;
}

.add-form .btn-add {
    flex: 0 1 auto;
    padding: 0.5rem 1.2rem;
    font-size: 0.85rem;
}

.entry-list {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.entry-item {
    background: #f4f6fa;
    padding: 0.5rem 0.8rem;
    border-radius: 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.3rem;
    color: #1a1a2e;
    font-size: 0.85rem;
}

[data-theme="dark"] .entry-item {
    background: #2a2a40;
    color: #eaeef2;
}

.entry-info {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.8rem;
    flex: 1;
}

.entry-info .site {
    font-weight: 600;
}
.entry-info .user {
    color: #4a6cf7;
}
.entry-info .pass {
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
    font-size: 0.8rem;
}

.entry-actions {
    display: flex;
    gap: 0.3rem;
}

.entry-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0.1rem 0.3rem;
    border-radius: 0.4rem;
    transition: 0.2s;
}

.entry-actions .edit-btn:hover {
    background: #d0d7de;
}
.entry-actions .delete-btn:hover {
    background: #fee8e8;
    color: #e74c3c;
}
.entry-actions .view-pass-btn:hover {
    background: #d0d7de;
}

[data-theme="dark"] .entry-actions .edit-btn:hover {
    background: #3d3d5c;
}
[data-theme="dark"] .entry-actions .delete-btn:hover {
    background: #3d2a2a;
}
[data-theme="dark"] .entry-actions .view-pass-btn:hover {
    background: #3d3d5c;
}

.entry-empty {
    color: #888;
    font-style: italic;
    text-align: center;
    padding: 0.6rem 0;
    font-size: 0.85rem;
}

[data-theme="dark"] .entry-empty {
    color: #8888aa;
}

.app-footer {
    text-align: center;
    padding: 0.6rem 1.2rem 0.8rem 1.2rem;
    font-size: 0.7rem;
    color: #9ca3af;
    border-top: 1px solid #e4e7ed;
}

[data-theme="dark"] .app-footer {
    border-top-color: #3a3a55;
    color: #6b7280;
}

@media (max-width: 600px) {
    body {
        padding: 0.4rem;
    }
    .app-container {
        border-radius: 1.2rem;
    }
    .app-header h1 {
        font-size: 1.1rem;
    }
    .tab-content {
        padding: 0.6rem;
    }
    .card {
        padding: 0.8rem;
        border-radius: 1rem;
    }
    .tab-btn {
        font-size: 0.75rem;
        padding: 0.4rem 0.7rem;
    }
    #passwordDisplay {
        font-size: 0.95rem;
        min-height: 2rem;
    }
    .options label {
        font-size: 0.75rem;
    }
    .length-control label {
        font-size: 0.8rem;
    }
    .length-control input[type="range"] {
        min-width: 80px;
    }
    .btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.8rem;
    }
    .auth-providers .btn {
        min-width: 100px;
        font-size: 0.8rem;
    }
    .add-form input {
        flex: 1 1 100%;
    }
    .password-input-wrapper {
        flex: 1 1 100%;
    }
    .add-form .btn-add {
        flex: 1 1 100%;
    }
    .entry-item {
        font-size: 0.75rem;
        padding: 0.4rem 0.6rem;
    }
    .entry-info {
        gap: 0.2rem 0.5rem;
    }
    .lock-screen h2 {
        font-size: 1.2rem;
    }
    .lock-icon {
        font-size: 2.8rem;
    }
    .manager-header h3 {
        font-size: 0.95rem;
    }
    .manager-actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 400px) {
    .tab-nav {
        gap: 0.15rem;
        padding: 0 0.6rem 0.2rem 0.6rem;
    }
    .tab-btn {
        font-size: 0.65rem;
        padding: 0.3rem 0.5rem;
    }
    .app-header h1 {
        font-size: 0.95rem;
    }
    .theme-toggle {
        width: 34px;
        height: 34px;
        font-size: 1.1rem;
    }
}