/* ===== Password Vault — Material Design v6 ===== */
:root {
  --primary: #1a73e8;
  --primary-light: #e8f0fe;
  --bg: #ffffff;
  --surface: #f8f9fa;
  --border: #dadce0;
  --text: #202124;
  --muted: #5f6368;
  --danger: #d93025;
  --success: #1e8e3e;
  --shadow: 0 1px 3px rgba(60,64,67,.3);
  --radius: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, "Google Sans", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.parser-test-results { padding: 20px; font-size: 14px; }

/* ===== Lock Screen ===== */
#lock-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; gap: 16px; padding: 24px;
  background: var(--bg);
}
#lock-screen h1 { font-size: 1.5rem; font-weight: 500; color: var(--text); }
#lock-screen p { color: var(--muted); font-size: 0.9rem; }
.lock-input {
  width: 100%; max-width: 320px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: 1rem; outline: none;
  transition: border-color .2s;
}
.lock-input:focus { border-color: var(--primary); }
#token-hint { font-size: 0.78rem; color: var(--muted); margin-top: 4px; text-align: center; }
.clear-token-link {
  font-size: 0.78rem; color: var(--muted); text-decoration: underline;
  cursor: pointer; background: none; border: none; padding: 4px;
}
.clear-token-link:hover { color: var(--primary); }

/* ===== Buttons ===== */
.btn {
  padding: 10px 24px; border: none; border-radius: 20px;
  font-size: 0.9rem; font-weight: 500; cursor: pointer;
  transition: background .15s, box-shadow .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #1765cc; box-shadow: var(--shadow); }
.btn-outline { background: var(--bg); color: var(--primary); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--primary-light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-full { width: 100%; margin-bottom: 12px; }

/* ===== Main App ===== */
#app { display: none; max-width: 600px; margin: 0 auto; padding: 0 16px 80px; }
#app.active { display: block; }

.app-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg); padding: 16px 0 12px;
  display: flex; justify-content: space-between; align-items: center;
}
.app-header h2 { font-size: 1.15rem; font-weight: 500; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.countdown { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ===== Paste Box (always visible) ===== */
.paste-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 16px; margin: 8px 0 12px; box-shadow: var(--shadow);
}
.paste-card label {
  display: block; font-size: 0.82rem; color: var(--muted);
  margin-bottom: 8px; font-weight: 500;
}
#paste-input {
  width: 100%; min-height: 72px; padding: 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: 0.88rem;
  font-family: inherit; resize: vertical; outline: none;
  transition: border-color .2s;
}
#paste-input:focus { border-color: var(--primary); }

.paste-result { margin-top: 10px; display: none; }
.paste-result.visible { display: block; }
.paste-fields { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.paste-field-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; font-size: 0.8rem;
}
.paste-field-chip .pf-label { color: var(--muted); font-size: 0.75rem; }
.paste-actions { display: flex; gap: 8px; }
.paste-actions .btn { flex: 1; }
.paste-kind-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 0.72rem; font-weight: 500; margin-left: 6px;
}
.kind-full { background: var(--primary-light); color: var(--primary); }
.kind-supplement { background: #fef7e0; color: #b06000; }

/* ===== Search ===== */
.search-bar {
  width: 100%; padding: 12px 16px; border: 1px solid var(--border);
  border-radius: 24px; background: var(--surface); color: var(--text);
  font-size: 0.92rem; margin-bottom: 12px; outline: none;
  transition: border-color .2s, background .2s;
}
.search-bar:focus { border-color: var(--primary); background: var(--bg); }

/* ===== Entry List ===== */
.entry-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.entry-title { font-weight: 500; font-size: 1rem; margin-bottom: 2px; }
.entry-category { font-size: 0.75rem; color: var(--muted); }
.entry-fields { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.field-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; background: var(--surface); border-radius: 6px;
  font-size: 0.82rem;
}
.field-chip .label { color: var(--muted); font-size: 0.75rem; }
.copy-btn {
  background: none; border: none; color: var(--primary); cursor: pointer;
  font-size: 0.78rem; padding: 2px 6px; border-radius: 4px;
}
.copy-btn:hover { background: var(--primary-light); }
.copy-btn.copied { color: var(--success); }
.entry-actions { display: flex; gap: 8px; margin-top: 10px; }

/* TOTP */
.totp-display { display: inline-flex; align-items: center; gap: 6px; }
.totp-code { font-family: "SF Mono", "Cascadia Code", monospace; font-size: 0.88rem; letter-spacing: 0.08em; }
.totp-timer { font-size: 0.72rem; color: var(--muted); }
.totp-bar { width: 40px; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.totp-bar-fill { height: 100%; background: var(--primary); border-radius: 2px; transition: width 1s linear; }

/* ===== Action Row (backup/import/change-pw) ===== */
.action-row {
  display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap;
}
.file-label { cursor: pointer; }

/* ===== FAB (Floating Action Button) ===== */
.fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 60;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary); color: #fff; border: none;
  font-size: 1.5rem; cursor: pointer; box-shadow: 0 4px 12px rgba(26,115,232,.4);
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s, box-shadow .15s;
}
.fab:hover { transform: scale(1.05); box-shadow: 0 6px 16px rgba(26,115,232,.5); }

/* ===== Modal ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(32,33,36,.5); z-index: 100;
  align-items: center; justify-content: center; padding: 16px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg); border-radius: var(--radius);
  padding: 24px; width: 100%; max-width: 480px;
  max-height: 85vh; overflow-y: auto; box-shadow: 0 8px 24px rgba(60,64,67,.2);
}
.modal h3 { margin-bottom: 16px; font-size: 1.05rem; font-weight: 500; }
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.form-group input, .form-group textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg); color: var(--text);
  font-size: 0.9rem; outline: none; font-family: inherit;
  transition: border-color .2s;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--primary); }
.form-group textarea { resize: vertical; min-height: 60px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; justify-content: flex-end; }

/* Supplement target picker */
.target-search {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg); color: var(--text);
  font-size: 0.9rem; margin-bottom: 8px; outline: none;
}
.target-search:focus { border-color: var(--primary); }
.target-list { max-height: 240px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.target-item {
  padding: 10px 14px; cursor: pointer; font-size: 0.88rem;
  border-bottom: 1px solid var(--border); transition: background .1s;
}
.target-item:last-child { border-bottom: none; }
.target-item:hover { background: var(--surface); }
.target-item.selected { background: var(--primary-light); }
.target-item .ti-title { font-weight: 500; }
.target-item .ti-user { color: var(--muted); font-size: 0.8rem; }

.overwrite-preview {
  background: var(--surface); border-radius: 8px; padding: 12px;
  margin-top: 10px; font-size: 0.85rem;
}
.overwrite-preview .ow-field { display: flex; justify-content: space-between; padding: 3px 0; }
.overwrite-preview .ow-label { color: var(--muted); }
.overwrite-warning {
  background: #fef7e0; border: 1px solid #fdd663; border-radius: 8px;
  padding: 10px 12px; margin-top: 10px; font-size: 0.82rem; color: #7a5800;
}

/* Toast */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #323232; color: #fff; padding: 12px 24px;
  border-radius: 8px; font-size: 0.85rem; opacity: 0;
  transition: opacity .3s; pointer-events: none; z-index: 200;
  white-space: nowrap; max-width: 90vw; overflow: hidden; text-overflow: ellipsis;
}
#toast.show { opacity: 1; }

.empty-state { text-align: center; padding: 40px 0; color: var(--muted); font-size: 0.9rem; }

/* ===== Mobile: 375px no horizontal scroll ===== */
@media (max-width: 480px) {
  #app { padding: 0 12px 80px; }
  .fab { bottom: 16px; right: 16px; width: 48px; height: 48px; font-size: 1.3rem; }
  .paste-card { padding: 12px; }
  .entry-card { padding: 12px; }
  .modal { padding: 16px; }
}
