:root {
  --bg: #eef1f5;
  --card: #ffffff;
  --field: #ffffff;
  --border: #d4dce6;
  --text: #1d2733;
  --muted: #5c6b7a;
  --primary: #2f7dd1;
  --primary-hover: #2768b0;
  --danger: #c0392b;
  --ok: #2e7d52;
  --hover: #eef3f8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 17px;
}

.centered {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 1px 3px rgba(16, 40, 70, .08);
}

h1 { margin: 0 0 4px; font-size: 27px; }
h2 { margin: 0 0 16px; font-size: 22px; }

.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }

label {
  display: block;
  margin: 14px 0 6px;
  font-size: 15px;
  color: var(--muted);
}

input, textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--field);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
}
input:focus, textarea:focus { outline: none; border-color: var(--primary); }

button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--field);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 16px;
}
button:hover { border-color: var(--primary); }
button:disabled { opacity: .6; cursor: default; }

button.primary, #unlockBtn, #submitBtn {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  width: 100%;
  margin-top: 18px;
}
form .primary { width: auto; margin-top: 0; }
button.primary:hover { background: var(--primary-hover); }
button.ghost { background: transparent; }
button.danger { color: var(--danger); }

textarea[readonly] { margin-top: 8px; word-break: break-all; }

.alert { padding: 10px 12px; border-radius: 8px; margin: 12px 0; font-size: 15px; }
.alert.error { background: rgba(192,57,43,.15); border: 1px solid var(--danger); }
.alert.ok { background: rgba(46,125,82,.15); border: 1px solid var(--ok); }
.alert a { color: var(--primary-hover); }

/* ---- vault ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 18px; }
.spacer { flex: 1; }

.container { max-width: 760px; margin: 0 auto; padding: 18px; }
.search { margin-bottom: 16px; }

.item-list { display: flex; flex-direction: column; gap: 10px; }
.item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 1px 2px rgba(16, 40, 70, .06);
}
.item-main { flex: 1; min-width: 0; }
.item-title { font-weight: 600; }
.item-sub { font-size: 14px; }
.item-pass {
  margin-top: 6px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 15px;
  word-break: break-all;
  color: var(--text);
}

.toast {
  position: fixed;
  left: 50%;
  top: 24px;
  transform: translateX(-50%) translateY(-20px);
  background: #1d2733;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.4;
  max-width: 90%;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 100;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.item-actions { display: flex; gap: 4px; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
}
.icon-btn:hover { background: var(--hover); color: var(--primary); border-color: var(--border); }
.icon-btn.danger:hover { color: var(--danger); background: rgba(192, 57, 43, .08); }
.icon-btn svg { display: block; }

.row { display: flex; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; margin-top: 20px; }
.row input { flex: 1; }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 50;
}
.modal { max-width: 480px; max-height: 90vh; overflow-y: auto; }

@media (max-width: 520px) {
  .item { flex-direction: column; align-items: stretch; }
  .item-actions { justify-content: flex-end; }
}
