/* The private vault.
   The section stays invisible until it is summoned — see vault.js for the two
   ways in. Nothing here renders the entry point, deliberately: a visible "🔒"
   would tell a companion there is something worth looking for.
   Colours come from the mint-green palette in styles.css, so a theme change
   still only touches :root. */

.vault-section {
  margin-top: 8px;
}

/* ------------------------------------------------------------------ *
 * Unlock prompt
 * ------------------------------------------------------------------ */

.vault-unlock {
  margin: 0;
  padding: 16px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.vault-unlock-copy {
  display: block;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.vault-unlock-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.vault-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7fdfa;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.vault-input:focus {
  outline: none;
  border-color: var(--lake);
  background: #fff;
}

.vault-input::placeholder {
  color: var(--muted);
  opacity: 0.75;
}

.vault-button {
  flex: none;
  min-height: 36px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--lake);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.vault-button:hover:not(:disabled) {
  background: var(--lake-deep);
}

.vault-button:disabled {
  opacity: 0.55;
  cursor: default;
}

.vault-error {
  margin: 10px 0 0;
  color: var(--warning);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
}

.vault-error[hidden] {
  display: none;
}

/* ------------------------------------------------------------------ *
 * Progress + lock
 * ------------------------------------------------------------------ */

.vault-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--lake-soft);
}

.vault-progress-label {
  flex: none;
  color: var(--lake-deep);
  font-size: 11px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.vault-progress {
  flex: 1 1 auto;
  min-width: 40px;
  height: 6px;
  border-radius: 999px;
  background: #fff;
  overflow: hidden;
}

.vault-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--lake);
  transition: width 0.18s ease;
}

.vault-lock-button {
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 10px;
  cursor: pointer;
}

.vault-lock-button:hover {
  color: var(--warning);
}

.vault-edit-button {
  flex: none;
  padding: 3px 12px;
  border: 1px solid var(--lake);
  border-radius: 999px;
  background: #fff;
  color: var(--lake-deep);
  font: inherit;
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
}

.vault-edit-button:hover {
  background: var(--lake-soft);
}

/* ------------------------------------------------------------------ *
 * Save status
 * ------------------------------------------------------------------ */

.vault-notice {
  margin: 0 0 12px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--lake-soft);
  color: var(--lake-deep);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
}

.vault-notice[hidden] {
  display: none;
}

.vault-notice.is-error {
  border-color: var(--warning);
  background: #fdf0ee;
  color: var(--warning);
}

.vault-origin {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.vault-origin b {
  color: var(--forest-deep);
}

/* ------------------------------------------------------------------ *
 * Editing
 * ------------------------------------------------------------------ */

.vault-item-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.vault-item-row .vault-item-label {
  flex: 1 1 auto;
  min-width: 0;
}

.vault-row-tools {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.vault-plain-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.vault-plain-button:hover {
  color: var(--lake-deep);
}

.vault-plain-button.is-danger:hover,
.vault-plain-button.is-danger.is-armed {
  color: var(--warning);
}

.vault-plain-button.is-armed {
  font-weight: 750;
}

/* A dashed outline marks the row being edited, so it is obvious which one the
   open form belongs to when two similar items sit next to each other. */
.vault-item.is-editing,
.vault-note.is-editing {
  padding: 10px 11px;
  border: 1px dashed var(--lake);
  border-radius: 10px;
  background: #f7fdfa;
  margin-bottom: 8px;
}

.vault-form {
  display: grid;
  gap: 7px;
}

.vault-field {
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
}

.vault-field:focus {
  outline: none;
  border-color: var(--lake);
}

.vault-field-body {
  resize: vertical;
  line-height: 1.7;
}

.vault-form-foot {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vault-button-small {
  min-height: 30px;
  padding: 0 14px;
  font-size: 11px;
}

.vault-add-button {
  width: 100%;
  margin-top: 9px;
  padding: 7px 0;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.vault-add-button:hover {
  border-color: var(--lake);
  color: var(--lake-deep);
}

.vault-edit-foot {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.vault-group-name {
  min-width: 0;
}

.vault-note-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}

.vault-note-head .vault-note-title {
  flex: 1 1 auto;
  margin: 0;
  min-width: 0;
}

/* ------------------------------------------------------------------ *
 * Groups
 * ------------------------------------------------------------------ */

.vault-groups {
  display: grid;
  gap: 12px;
}

.vault-group {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.vault-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  color: var(--forest-deep);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.vault-group-count {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--lake-soft);
  color: var(--lake-deep);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.vault-items {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.vault-item {
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.vault-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.vault-item-label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  cursor: pointer;
}

/* A real checkbox, restyled. Keeping the native input means keyboard focus,
   the accessibility tree and the change event all still behave normally. */
.vault-check {
  position: relative;
  flex: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: #fff;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.vault-check:checked {
  border-color: var(--lake);
  background: var(--lake);
}

.vault-check:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1.5px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.vault-check:focus-visible {
  outline: 2px solid var(--lake);
  outline-offset: 2px;
}

.vault-item-text {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.vault-item.is-done .vault-item-text {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--mint);
  text-decoration-thickness: 2px;
}

.vault-item-note {
  margin: 4px 0 0 27px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------ *
 * Notes
 * ------------------------------------------------------------------ */

.vault-notes {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.vault-notes-heading {
  margin: 0;
  color: var(--forest-deep);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.vault-note {
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--sand-deep);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.vault-note-title {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.vault-note-text {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.75;
  overflow-wrap: anywhere;
  /* Notes are written as short paragraphs; without this every "\n" collapses
     into a space and a timeline turns into one wall of text. */
  white-space: pre-line;
}

@media (max-width: 560px) {
  .vault-unlock-row {
    flex-wrap: wrap;
  }

  .vault-button {
    flex: 1 1 100%;
  }
}

/* The local-only doorway. It is rendered only when the page is opened off disk
   or off localhost — see localDoorwayAllowed() in vault.js — so a deployed page
   never carries it. Dressed as small print on the footer line rather than as a
   control bolted onto it. */
.vault-doorway {
  flex: none;
  margin: -15px auto 0 12px;
  padding: 0 14px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px dashed var(--lake);
  border-radius: 999px;
  background: var(--lake-soft);
  color: var(--lake-deep);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
  cursor: pointer;
}

.vault-doorway:hover {
  background: var(--mint);
}
