/* LockBox — encrypted vault styling */
.lockbox-note {
  background: var(--gold-soft, #fdf3d7);
  color: #765318;
  border: 1px solid rgba(200,150,50,.25);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 12.5px;
  line-height: 1.5;
  margin: 0 0 16px;
}
.lockbox-note strong { color: #5a3e0e; }

.lockbox-strength {
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  margin: 14px 0 4px;
  overflow: hidden;
  position: relative;
}
.lockbox-strength::after {
  content: '';
  display: block;
  height: 100%;
  width: 0%;
  background: #c83c3c;
  border-radius: 999px;
  transition: width .3s ease, background .3s ease;
}
.lockbox-strength[data-level="1"]::after { width: 33%; background: #c83c3c; }
.lockbox-strength[data-level="2"]::after { width: 66%; background: #d99a2a; }
.lockbox-strength[data-level="3"]::after { width: 100%; background: #228b56; }

.lockbox-forgot {
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.lockbox-forgot a { color: var(--green); text-decoration: none; font-weight: 600; }

#lockboxUnlocked .lockbox-header-actions {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end;
}

.lockbox-busy {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.lockbox-busy::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  #page-lockbox .card { padding: 16px !important; }
}

/* ---------- LockBox: entry list (Phase 3) ---------- */
.lockbox-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.lockbox-head-actions { display: flex; gap: 8px; flex: none; }

.lockbox-toolbar {
  display: flex; flex-direction: column; gap: 12px;
  margin: 4px 0 16px;
}
.lockbox-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.lockbox-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--muted); font-size: 12.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}
.lockbox-chip:hover { color: var(--ink); border-color: color-mix(in srgb, var(--green) 40%, var(--line)); transform: translateY(-1px); }
.lockbox-chip.active { background: var(--green); color: #fff; border-color: var(--green); box-shadow: 0 4px 12px rgba(23,107,85,.22); }
.lockbox-chip .lockbox-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 18px; padding: 0 6px;
  border-radius: 9px; background: var(--surface-2); color: var(--muted);
  font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.lockbox-chip.active .lockbox-count { background: rgba(255,255,255,.24); color: #fff; }

.lockbox-list { display: grid; gap: 10px; }

.lockbox-entry {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 14px; align-items: center;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.lockbox-entry:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(23,107,85,.10);
  border-color: color-mix(in srgb, var(--green) 30%, var(--line));
}
.lockbox-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--green-soft); color: var(--green-dark);
  font-size: 20px; flex: none;
}
.lockbox-main { min-width: 0; }
.lockbox-name {
  font-size: 14px; font-weight: 700; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lockbox-sub {
  font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-top: 2px;
}
.lockbox-actions { display: flex; gap: 6px; flex: none; }
.lockbox-action {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--surface-2); border: 0; color: var(--muted);
  cursor: pointer; font-size: 14px;
  transition: background .15s ease, color .15s ease;
}
.lockbox-action:hover { background: color-mix(in srgb, var(--green) 18%, var(--surface-2)); color: var(--green-dark); }
.lockbox-action.danger:hover { background: rgba(200,60,60,.12); color: #c83c3c; }

.lockbox-empty-hint {
  padding: 28px 16px; text-align: center;
  color: var(--muted); font-size: 13px; line-height: 1.6;
}
.lockbox-empty-hint strong { color: var(--ink); }

/* LockBox entry modal */
.lockbox-form .form-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
.lockbox-form .field-wide { grid-column: 1 / -1; }
.lockbox-pw-wrap { position: relative; display: block; }
.lockbox-pw-wrap input { padding-right: 84px !important; }
.lockbox-inline-actions {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  display: flex; gap: 4px;
}
.lockbox-inline-actions button {
  width: 32px; height: 32px; border-radius: 8px;
  background: transparent; border: 0; color: var(--muted);
  display: grid; place-items: center; cursor: pointer; font-size: 14px;
}
.lockbox-inline-actions button:hover { background: var(--surface-2); color: var(--ink); }
.lockbox-inline-actions button.on { color: var(--green); }

.lockbox-modal-actions {
  display: flex; gap: 8px; justify-content: space-between;
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line);
}
.lockbox-modal-actions .right { display: flex; gap: 8px; }
.lockbox-delete { color: var(--red); border-color: var(--red-soft); }

.lockbox-copy-feedback {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #111715; color: #fff;
  padding: 10px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  z-index: 500;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.lockbox-copy-feedback.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

@media (max-width: 900px) {
  .lockbox-form .form-grid { grid-template-columns: 1fr; }
  .lockbox-entry { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; padding: 12px; }
  .lockbox-icon { width: 40px; height: 40px; font-size: 18px; }
  .lockbox-head { flex-direction: column; align-items: stretch; }
  .lockbox-head-actions { justify-content: stretch; }
  .lockbox-head-actions button { width: 100%; }
  .lockbox-chips { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .lockbox-chips::-webkit-scrollbar { display: none; }
  .lockbox-chip { flex: 0 0 auto; }
}

/* ============================================================
   Desktop: LockBox layout — wider cards, smaller placeholder
   ============================================================ */
@media (min-width: 901px) {

  /* Wider cards so the form fills the content column properly */
  #lockboxSetup,
  #lockboxLocked   { max-width: 900px; }
  #lockboxUnlocked { max-width: 1000px; }

  /* --- Field visuals: bigger box, smaller placeholder --- */
  #lockboxSetup .field input,
  #lockboxLocked .field input {
    height: 54px !important;
    min-height: 54px !important;
    padding: 0 16px !important;
    font-size: 14px !important;
    border-radius: 12px;
  }

  /* Input placeholder — smaller + lighter */
  #lockboxSetup .field input::placeholder,
  #lockboxLocked .field input::placeholder {
    font-size: 13px !important;
    color: var(--muted);
    opacity: .75;
    letter-spacing: .01em;
  }

  /* Password fields need room for the eye toggle on the right */
  #lockboxSetup .pw-wrap input,
  #lockboxLocked .pw-wrap input {
    padding: 0 56px 0 16px !important;
  }

  /* Fix the vertical misalignment of the eye toggle button */
  #lockboxSetup .pw-toggle,
  #lockboxLocked .pw-toggle {
    top: 50% !important;
    transform: translateY(-50%) !important;
    right: 12px !important;
    width: 32px !important;
    height: 32px !important;
    font-size: 15px !important;
    display: grid;
    place-items: center;
  }

  /* --- Labels: compact, clearly above the field --- */
  #lockboxSetup .field,
  #lockboxLocked .field {
    margin-bottom: 6px;
  }
  #lockboxSetup .field label,
  #lockboxLocked .field label {
    display: block;
    margin-bottom: 8px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
  }

  /* --- Button: matches the field's bottom edge, comfortable size --- */
  #lockboxSetup .form-actions,
  #lockboxLocked .form-actions {
    justify-content: flex-start;
    margin-top: 22px;
  }
  #lockboxSetup .form-actions .primary,
  #lockboxLocked .form-actions .primary {
    min-height: 48px;
    padding: 0 26px;
    font-size: 14.5px;
  }

  /* --- Card internal padding for a wider, airier feel --- */
  #lockboxSetup .card,
  #lockboxLocked .card {
    padding: 24px 28px !important;
  }
}
