/* ============================================================
   VaultKeep — "Vault" design system
   Dark strongroom palette + amber accent (the vault light).
   Mono face for anything data-like (codes, credentials);
   Inter for reading text.
   ============================================================ */

:root {
  --bg:        #0B0F14;
  --surface:   #131A22;
  --surface-2: #1A2330;
  --border:    #253242;
  --text:      #E8EDF2;
  --text-muted:#8A98A8;
  --accent:    #D4A537;
  --accent-dim:#8C6F2A;
  --accent-ink:#1A1400;
  --danger:    #E5484D;
  --success:   #3DDC97;
  --radius:    14px;
  --radius-sm: 9px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

h1, h2, h3, .mono, .otp-box, .pw-reveal, .brand {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---------- App shell ---------- */
.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 60px rgba(0,0,0,0.5);
}

@media (min-width: 481px) {
  body { background: #05070A; }
  .app-shell { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(16px + var(--safe-top)) 20px 14px;
  background: linear-gradient(180deg, var(--surface) 0%, rgba(19,26,34,0.96) 100%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }

.topbar-actions { display: flex; gap: 10px; align-items: center; }
.icon-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
}
.icon-btn:active { transform: scale(0.94); }

/* ---------- Content ---------- */
.content {
  flex: 1;
  padding: 18px 20px 100px;
}

.page-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin: 4px 0 18px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.item-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
}

.item-avatar {
  width: 42px; height: 42px;
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.item-info { flex: 1; min-width: 0; }
.item-title { font-weight: 600; font-size: 15px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

.item-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: rgba(229,72,77,0.12); color: var(--danger); border: 1px solid rgba(229,72,77,0.35); }
.btn-sm { width: auto; padding: 9px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.field input, .field textarea, .field select {
  width: 100%;
  padding: 13px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}
.field textarea { resize: vertical; min-height: 80px; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212,165,55,0.15);
}
.field-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.input-with-icon { position: relative; }
.input-with-icon input { padding-right: 44px; }
.input-with-icon .toggle-visibility {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 6px;
}

/* ---------- Auth screens (login/otp) ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 26px;
  max-width: 480px;
  margin: 0 auto;
}
.auth-lock {
  width: 64px; height: 64px;
  border-radius: 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  margin-bottom: 22px;
}
.auth-title { font-size: 22px; font-weight: 700; margin: 0 0 6px; }
.auth-sub { color: var(--text-muted); font-size: 14px; margin: 0 0 28px; line-height: 1.5; }

/* OTP boxes */
.otp-row { display: flex; gap: 8px; margin-bottom: 8px; }
.otp-box {
  width: 100%;
  aspect-ratio: 1;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--accent);
}
.otp-box:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(212,165,55,0.15); }

.resend-row { text-align: center; margin-top: 18px; font-size: 13.5px; color: var(--text-muted); }
.resend-row button { background: none; border: none; color: var(--accent); font-weight: 600; cursor: pointer; padding: 0; font-size: 13.5px; }

/* ---------- Password reveal ---------- */
.pw-reveal {
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 16px;
  letter-spacing: 1px;
  color: var(--success);
  word-break: break-all;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.masked { letter-spacing: 3px; color: var(--text-muted); }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  background: rgba(19,26,34,0.96);
  border-top: 1px solid var(--border);
  padding: 8px 10px calc(8px + var(--safe-bottom));
  backdrop-filter: blur(10px);
}
.nav-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 0;
  color: var(--text-muted);
  font-size: 11px;
  border-radius: 10px;
}
.nav-item.active { color: var(--accent); }
.nav-item svg { width: 22px; height: 22px; }

/* ---------- FAB ---------- */
.fab {
  position: fixed;
  right: calc(50% - 240px + 20px);
  bottom: calc(78px + var(--safe-bottom));
  width: 56px; height: 56px;
  border-radius: 18px;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(212,165,55,0.35);
  border: none;
  cursor: pointer;
  z-index: 25;
}
@media (max-width: 480px) { .fab { right: 20px; } }
.fab:active { transform: scale(0.94); }

/* ---------- Badges / alerts ---------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.badge-admin { background: rgba(212,165,55,0.15); color: var(--accent); }
.badge-user { background: var(--surface-2); color: var(--text-muted); }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 14px; }
.alert-success { background: rgba(61,220,151,0.1); color: var(--success); border: 1px solid rgba(61,220,151,0.3); }
.alert-error { background: rgba(229,72,77,0.1); color: var(--danger); border: 1px solid rgba(229,72,77,0.3); }
.alert-info { background: rgba(212,165,55,0.1); color: var(--accent); border: 1px solid rgba(212,165,55,0.3); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state svg { color: var(--border); margin-bottom: 14px; }

.divider { height: 1px; background: var(--border); margin: 18px 0; border: none; }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

::selection { background: rgba(212,165,55,0.3); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
