/* =========================================================================
   VAULT — Password Manager & ENV File Store
   ========================================================================= */

#vaultPanel {
  grid-column: 1;
  grid-row: 3;
  display: none;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}
#vaultPanel.visible { display: flex; }

/* ---- Header ---- */
.vault-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.vault-header h2 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text);
  margin: 0;
  flex: 1;
}
.vault-search {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  padding: 5px 10px;
  width: 200px;
  outline: none;
}
.vault-search::placeholder { color: var(--faint); }
.vault-search:focus { border-color: var(--line-bright); }

.vault-add-btn {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 6px 12px;
  cursor: pointer;
}
.vault-add-btn:hover { opacity: .85; }

/* ---- Tab bar ---- */
.vault-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.vault-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 10px 18px;
  cursor: pointer;
  margin-bottom: -1px;
}
.vault-tab:hover { color: var(--text); }
.vault-tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---- Entry list ---- */
.vault-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.vault-list {
  width: 260px;
  min-width: 200px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  flex-shrink: 0;
}
.vault-list-empty {
  padding: 28px 16px;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
}
.vault-entry-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  user-select: none;
}
.vault-entry-row:hover { background: var(--card-hover); }
.vault-entry-row.selected { background: var(--card); border-left: 2px solid var(--accent); padding-left: 12px; }
.vault-entry-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 1px solid var(--line);
  flex-shrink: 0;
  color: var(--muted);
}
.vault-entry-meta { flex: 1; min-width: 0; }
.vault-entry-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vault-entry-sub {
  font-size: 11px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* ---- Detail pane ---- */
.vault-detail {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
}
.vault-detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--faint);
  font-size: 13px;
}
.vault-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}
.vault-detail-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.vault-detail-type {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 3px;
}
.vault-detail-actions {
  display: flex;
  gap: 6px;
}
.vault-icon-btn {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 5px 8px;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.vault-icon-btn:hover { color: var(--text); border-color: var(--line-bright); }
.vault-icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); }

/* ---- Fields ---- */
.vault-field {
  margin-bottom: 16px;
}
.vault-field-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 5px;
}
.vault-field-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.vault-field-value {
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
  flex: 1;
}
.vault-field-value a { color: var(--accent2); text-decoration: none; }
.vault-field-value a:hover { text-decoration: underline; }
.vault-password-dots {
  letter-spacing: 3px;
  font-size: 14px;
  color: var(--muted);
}
.vault-env-content {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 360px;
  overflow-y: auto;
  margin-top: 5px;
}
.vault-field-divider {
  border: none;
  border-top: 1px solid var(--line-soft);
  margin: 20px 0;
}

/* ---- Copy flash ---- */
.vault-copied-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 8px 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  z-index: 9999;
}
.vault-copied-toast.show { opacity: 1; }

/* ---- Modal ---- */
.vault-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 8000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.vault-modal {
  background: var(--panel);
  border: 1px solid var(--line);
  width: 480px;
  max-width: 92vw;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
}
.vault-modal h3 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text);
  margin: 0 0 20px;
}
.vault-modal-field { margin-bottom: 14px; }
.vault-modal-field label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 5px;
}
.vault-modal-field input,
.vault-modal-field textarea {
  width: 100%;
  box-sizing: border-box;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  padding: 8px 10px;
  outline: none;
  font-family: inherit;
  resize: vertical;
}
.vault-modal-field textarea { min-height: 120px; font-family: var(--font-mono); }
.vault-modal-field input:focus,
.vault-modal-field textarea:focus { border-color: var(--line-bright); }

.vault-modal-field .vault-pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.vault-modal-field .vault-pw-wrap input { padding-right: 34px; }
.vault-pw-toggle {
  position: absolute;
  right: 0;
  background: none;
  border: none;
  color: var(--faint);
  cursor: pointer;
  padding: 0 8px;
  height: 100%;
  font-size: 12px;
}
.vault-pw-toggle:hover { color: var(--text); }
.vault-modal-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}
.vault-btn {
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 7px 14px;
  cursor: pointer;
}
.vault-btn:hover { color: var(--text); border-color: var(--line-bright); }
.vault-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.vault-btn.primary:hover { opacity: .85; }
