:root {
    --primary: #007A3D;
    --primary-light: #009947;
    --primary-bg: #e6f2eb;
    --accent: #d4af37;
    --red: #e74c3c;
    --red-bg: #fdecea;
    --text-dark: #1a2a1e;
    --text-medium: #4a6a5a;
    --text-light: #7a9a87;
    --bg: #f2f7f4;
    --card: #ffffff;
    --border: #d8ebe0;
    --shadow: 0 1px 4px rgba(0, 90, 46, 0.08);
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text-dark);
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }
.hidden { display: none !important; }
button { cursor: pointer; font-family: inherit; }
input, textarea { font-family: inherit; }

/* ── Centered auth screens ─────────────────────────────────────────────── */

.auth-container {
    max-width: 420px;
    margin: 0 auto;
    padding: 40px 20px 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    min-height: 100vh;
    justify-content: center;
}

.auth-logo { text-align: center; }

.auth-logo-wrap {
    background: white;
    border-radius: 16px;
    padding: 14px 20px;
    display: inline-block;
    margin: 0 auto 16px;
    box-shadow: 0 4px 20px rgba(0, 122, 61, 0.18);
    border: 1px solid var(--border);
}

.auth-logo-wrap svg { width: 160px; height: auto; display: block; }

.auth-logo h1 { font-size: 22px; font-weight: 700; }
.auth-logo p { font-size: 14px; color: var(--text-medium); margin-top: 4px; }

.auth-card {
    width: 100%;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-card h2 { font-size: 18px; font-weight: 700; }
.auth-card .subtitle { font-size: 13px; color: var(--text-medium); margin-top: -8px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text-medium); }

.input, .textarea, select.input {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    font-size: 15px;
    background: white;
    color: var(--text-dark);
    width: 100%;
}

.input:focus, .textarea:focus { outline: none; border-color: var(--primary); }

.input-code {
    text-align: center;
    font-size: 22px;
    letter-spacing: 4px;
    font-weight: 700;
}

.btn {
    border: none;
    border-radius: var(--radius-sm);
    padding: 11px 18px;
    font-size: 14.5px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: opacity 0.15s;
}
.btn:hover { opacity: 0.88; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-full { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

.btn-primary { background: var(--primary); color: white; }
.btn-success { background: var(--primary-light); color: white; }
.btn-outline { background: white; color: var(--primary); border: 1px solid var(--border); }
.btn-outline-danger { background: white; color: var(--red); border: 1px solid #f3c9c5; }
.btn-danger { background: var(--red); color: white; }
.btn-ghost { background: transparent; color: var(--text-medium); }

.error-box {
    background: var(--red-bg);
    color: var(--red);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13.5px;
    font-weight: 600;
}

.locked-box {
    background: var(--red-bg);
    color: var(--red);
    border-radius: var(--radius-sm);
    padding: 18px;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
}
.locked-box .timer { font-size: 26px; margin-top: 6px; letter-spacing: 1px; }

.qr-wrap { text-align: center; }
.qr-wrap img { width: 200px; height: 200px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.secret-text {
    font-family: 'Courier New', monospace;
    background: var(--primary-bg);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    word-break: break-all;
    text-align: center;
    margin-top: 8px;
}

.backup-codes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    background: var(--primary-bg);
    border-radius: var(--radius-sm);
    padding: 14px;
}
.backup-codes span {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
}

.warning-box {
    background: #fef7e0;
    color: #8a6d1a;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13px;
}

.checkbox-row { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; }

/* ── App shell ─────────────────────────────────────────────────────────── */

.app-header {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}

.app-header-left { display: flex; align-items: center; gap: 12px; }
.app-header-left svg { height: 30px; width: auto; }
.app-header h1 { font-size: 16px; font-weight: 700; }
.app-header-right { display: flex; align-items: center; gap: 10px; }

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 20px 80px;
}

.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-input { flex-grow: 1; }

.cred-grid { display: flex; flex-direction: column; gap: 10px; }

.cred-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cred-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cred-name { font-size: 16px; font-weight: 700; }
.cred-url { font-size: 12.5px; color: var(--primary); text-decoration: none; }
.cred-actions { display: flex; gap: 6px; flex-shrink: 0; }

.cred-field {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 13.5px;
}
.cred-field label { color: var(--text-medium); min-width: 68px; font-weight: 600; }
.cred-field .value { flex-grow: 1; font-family: 'Courier New', monospace; word-break: break-all; }
.cred-field button { background: none; border: none; color: var(--primary); font-size: 13px; padding: 2px 6px; }

.cred-notes { font-size: 12.5px; color: var(--text-medium); font-style: italic; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-medium); }
.empty-state .icon { font-size: 40px; margin-bottom: 10px; }

/* ── Modal ─────────────────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 40, 30, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 16px;
}

.modal {
    background: white;
    border-radius: var(--radius);
    padding: 22px;
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-header { display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-header button { background: none; border: none; font-size: 18px; color: var(--text-medium); }

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-dark);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    z-index: 200;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

@media (max-width: 600px) {
    .backup-codes { grid-template-columns: 1fr; }
    .cred-field label { min-width: 56px; }
}
