/* ApiPass (web app) — tool-specific styling on top of node.css (ARGUS design system).
   All functional IDs/classes are preserved; app.js drives them unchanged.
   Semantic status tokens (--ok/--warn/--err) are referenced by app.js too. */

:root {
  --ok:   oklch(0.78 0.13 162);
  --warn: oklch(0.80 0.13 75);
  --err:  oklch(0.70 0.17 25);
  --focus: var(--accent-soft);
}

.hidden { display: none !important; }
::selection { background: var(--accent); color: var(--bg); }

/* keyboard focus ring on every control */
:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); border-radius: 3px; }

/* tabular numerals for data-ish text */
.vault-stats, .entry-meta, .attach-size, .entry-attach, .tag, .icon-btn, #pw-strength-label { font-variant-numeric: tabular-nums; }

/* ============================ APP SHELL ============================ */
/* override node.css landing grid: each screen controls its own layout.
   Lock screen = wide ARGUS hero (like the landing); vault = centered column. */
main {
  display: block;
  padding: clamp(36px, 5vw, 80px) var(--gutter-x) clamp(40px, 5vw, 72px);
}
.vault-screen { max-width: 860px; margin: 0 auto; }

h2 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 18px; font-weight: 600; letter-spacing: -0.01em;
  margin: 0 0 14px; color: var(--fg);
}

/* ---------------------------- header rail extras ---------------------------- */
.icon-btn-square {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  background: transparent; border: 1px solid var(--line); border-radius: 3px;
  color: var(--mid); cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.icon-btn-square:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.icon-btn-square svg { transition: transform .35s var(--ease); }
.icon-btn-square:hover svg { transform: rotate(70deg); }

/* ============================ BUTTONS / INPUTS ============================ */
/* redefine .btn for app density (overrides node.css .btn by source order) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--bg-3); border: 1px solid var(--line); color: var(--fg);
  padding: 9px 15px; border-radius: 3px; cursor: pointer;
  font-family: "IBM Plex Mono", monospace; font-size: 12px;
  letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none;
  transition: border-color .15s, background .15s, transform .15s var(--ease), color .15s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }

.btn-primary {
  background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600;
}
.btn-primary:hover:not(:disabled) { color: var(--bg); background: var(--accent-2); border-color: var(--accent-2); box-shadow: 0 8px 22px -12px var(--accent); transform: translateY(-1px); }
.btn-sm { padding: 6px 11px; font-size: 11px; }
.lock-btn { font-size: 11px; }

.text-input {
  background: var(--bg); border: 1px solid var(--line); color: var(--fg);
  padding: 10px 12px; border-radius: 3px;
  font-family: "Space Grotesk", sans-serif; font-size: 14px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.text-input.mono { font-family: "IBM Plex Mono", monospace; font-size: 13px; }
.text-input::placeholder { color: var(--dim); }
.text-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.text-input { cursor: pointer; }
textarea.text-input { resize: vertical; }

.field-label {
  display: block; font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin: 16px 0 6px;
}

.pw-label-row { display: flex; justify-content: space-between; align-items: baseline; }
.link-btn { background: none; border: 0; color: var(--accent); font-family: "IBM Plex Mono", monospace; font-size: 11px; cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; }

.hint { color: var(--fg-2); font-size: 13px; line-height: 1.5; margin: 0 0 8px; }
.form-error { color: var(--err); font-size: 13px; min-height: 1.2rem; margin: 12px 0 0; font-family: "IBM Plex Mono", monospace; }

/* ============================ LOCK SCREEN ============================ */
/* two-column ARGUS hero: identity (wordmark) + ops panel (unlock/create) */
.lock-screen {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: clamp(24px, 4vw, 56px);
  align-items: start;            /* top-align so the unlock panel is visible immediately */
  max-width: 1180px;
  margin: 0 auto;
}
/* compact wordmark in the app so the two columns fit on narrower windows
   (keeps the unlock tool beside the hero instead of below the fold) */
.lock-screen .wordmark.product { font-size: clamp(46px, 6.5vw, 88px); }

/* only stack on real phones, and put the tool first when stacked */
@media (max-width: 700px) {
  .lock-screen { grid-template-columns: 1fr; gap: 26px; }
  .lock-screen .ops { order: 1; }
  .lock-screen .identity { order: 2; }
  .lock-screen .identity .wordmark.product { font-size: clamp(44px, 12vw, 60px); }
}

.lock-tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.lock-tab {
  background: transparent; border: 0; border-bottom: 2px solid transparent;
  color: var(--dim); padding: 11px 16px; cursor: pointer; margin-bottom: -1px;
  font-family: "IBM Plex Mono", monospace; font-size: 12px;
  letter-spacing: 0.08em; text-transform: uppercase;
  transition: color .15s, border-color .15s;
}
.lock-tab:hover { color: var(--fg-2); }
.lock-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.lock-panel { display: flex; flex-direction: column; }
.lock-panel .btn-primary { margin-top: 20px; }
.touchid-btn { margin-top: 10px; }
.touchid-btn::before { content: "\2609  "; opacity: 0.85; }

.file-pick { margin-top: 4px; cursor: pointer; justify-content: flex-start; }
.file-pick.has-file { border-color: var(--accent); color: var(--accent); }

/* password strength meter */
.pw-strength { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.pw-bar { flex: 1; height: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
#pw-bar-fill { height: 100%; width: 0; background: var(--err); transition: width .2s ease, background .2s ease; }
#pw-strength-label { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--mid); min-width: 8ch; text-align: right; }

/* ============================ VAULT TOOLBAR ============================ */
.vault-toolbar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.vault-toolbar .search { flex: 1; min-width: 180px; }
.vault-toolbar .btn-primary { white-space: nowrap; }

.dirty-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: oklch(0.80 0.13 75 / 0.10); border: 1px solid var(--warn);
  border-radius: 3px; padding: 10px 14px; margin-bottom: 16px;
  font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--fg-2);
}

.vault-stats { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--mid); margin: 0 0 12px 2px; letter-spacing: 0.04em; }
.vault-stats.big { color: var(--warn); }

/* ============================ ENTRIES ============================ */
.entry {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px;
  padding: 14px 16px; margin-bottom: 10px;
  transition: border-color .15s, transform .15s var(--ease);
}
.entry:hover { border-color: var(--accent); transform: translateY(-1px); }

.entry-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.entry-service { font-family: "Space Grotesk", sans-serif; font-weight: 600; font-size: 15px; color: var(--fg); }
.entry-label { color: var(--mid); font-size: 13px; }

.entry-tags { display: flex; gap: 6px; margin-left: auto; }
.tag {
  font-family: "IBM Plex Mono", monospace; font-size: 9.5px;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 3px; border: 1px solid var(--line); color: var(--mid);
}
.tag.env-prod { color: var(--err); border-color: var(--err); }
.tag.env-staging { color: var(--warn); border-color: var(--warn); }
.tag.env-dev { color: var(--ok); border-color: var(--ok); }
.tag.stale { color: var(--warn); border-color: var(--warn); }
.tag.clickable { cursor: pointer; }
.tag.clickable:hover { border-color: var(--accent); color: var(--accent); }

.entry-secret-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.entry-secret {
  flex: 1; font-family: "IBM Plex Mono", monospace; font-size: 12.5px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 3px;
  padding: 8px 11px; word-break: break-all; user-select: none; color: var(--fg-2);
}
.entry-secret.revealed { user-select: all; color: var(--fg); }

.icon-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 1px solid var(--line); color: var(--mid);
  padding: 6px 10px; border-radius: 3px; cursor: pointer; white-space: nowrap;
  font-family: "IBM Plex Mono", monospace; font-size: 11px; letter-spacing: 0.04em;
  transition: color .15s, border-color .15s, background .15s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.icon-btn.ok { color: var(--accent); border-color: var(--accent); animation: okPulse 240ms var(--ease); }
@keyframes okPulse { 0% { transform: scale(1); } 45% { transform: scale(1.07); } 100% { transform: scale(1); } }

.entry-notes { margin: 10px 0 0; font-size: 13px; color: var(--mid); white-space: pre-wrap; line-height: 1.5; }
.entry-foot { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
.entry-meta { margin-left: auto; font-family: "IBM Plex Mono", monospace; font-size: 10.5px; color: var(--dim); }
.entry-attach { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; color: var(--mid); border: 1px solid var(--line); border-radius: 3px; padding: 2px 7px; }

.empty-state { color: var(--mid); text-align: center; padding: 36px 16px; font-size: 14px; }

/* ============================ MODALS ============================ */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: oklch(0.10 0.008 240 / 0.72); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 48px 16px; overflow-y: auto; animation: overlayIn 150ms ease;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 24px; max-width: 480px; width: 100%;
  box-shadow: 0 30px 70px -30px #000; animation: modalIn 190ms var(--ease);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
.modal h2 { margin-top: 0; }

.field-row { display: flex; gap: 12px; }
.field-col { flex: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }

/* attachments */
.attach-list { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
.attach-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 3px;
  padding: 8px 10px; font-size: 13px;
}
.attach-name { flex: 1; word-break: break-all; }
.attach-name::before { content: "\1F4CE  "; }
.attach-size { color: var(--dim); font-size: 11px; white-space: nowrap; font-family: "IBM Plex Mono", monospace; }
.attach-add { margin-top: 4px; }
.attach-note { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--dim); margin: 8px 0 0; line-height: 1.5; }

/* settings */
.set-check { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 14px; cursor: pointer; color: var(--fg-2); }
.set-check input { width: auto; accent-color: var(--accent); }
.set-divider { border: 0; border-top: 1px solid var(--line); margin: 20px 0 4px; }
.chpw-second { margin-top: 6px; }
.chpw-btn { margin-top: 10px; }

/* ============================ ABOUT (lock screen) ============================ */
.about {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px;
  padding: 14px 16px; font-size: 13px; margin-top: 24px; color: var(--fg-2);
}
.about summary {
  cursor: pointer; list-style: none;
  font-family: "IBM Plex Mono", monospace; font-size: 12px;
  letter-spacing: 0.04em; color: var(--mid);
}
.about summary::-webkit-details-marker { display: none; }
.about summary::before { content: "\25B8  "; color: var(--accent); }
.about[open] summary::before { content: "\25BE  "; }
.about summary:hover { color: var(--fg-2); }
.about ul { padding-left: 18px; line-height: 1.6; }
.about code { background: var(--bg-3); padding: 1px 6px; border-radius: 3px; font-family: "IBM Plex Mono", monospace; font-size: 0.85em; border: 1px solid var(--line); }
.about .danger { color: var(--err); }

/* ============================ FOOTER ============================ */
#clab-link { color: var(--accent); }

/* ============================ RESPONSIVE ============================ */
@media (max-width: 600px) {
  main { padding: 28px 16px 64px; }
  .vault-toolbar { flex-direction: column; align-items: stretch; }
  .field-row { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .entry:hover, .btn:hover { transform: none !important; }
  .icon-btn-square:hover svg { transform: none !important; }
}
