/* PassVault v2 — light mode, aksen biru. Mobile-first, presisi 16px. */
:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-soft: #EFF6FF;
  --bg: #F1F5F9;
  --card: #FFFFFF;
  --text: #0F172A;
  --muted: #64748B;
  --border: #E2E8F0;
  --danger: #DC2626;
  --danger-soft: #FEF2F2;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 12px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- views ---------- */
.view { min-height: 100vh; }

/* ---------- lock ---------- */
#view-lock {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(135deg, #DBEAFE 0%, #F1F5F9 60%, #EFF6FF 100%);
}
.lock-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 32px 24px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.lock-logo { font-size: 52px; margin-bottom: 12px; }
.lock-card h1 { font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.lock-card > .muted { font-size: 14px; margin-bottom: 24px; }
.lock-card .field-label { text-align: left; }
.lock-card .foot { margin-top: 24px; font-size: 12px; color: var(--muted); }
.warn {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  color: #92400E;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin-top: 16px;
  text-align: left;
}
.form-error {
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  margin-top: 8px;
  text-align: center;
}

/* strength meter */
.strength { margin: 8px 0 4px; text-align: left; }
.strength-bar {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 4px;
}
#strength-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: #ef4444;
  transition: width .25s ease, background .25s ease;
}
#strength-label { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------- app layout ---------- */
#view-app { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.wrap { max-width: 640px; margin: 0 auto; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo {
  font-size: 22px;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft);
  border-radius: 12px;
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 17px; font-weight: 800; }
.header-actions { display: flex; gap: 8px; flex-shrink: 0; }

.search-wrap { padding: 12px 16px 4px; }

.chips::-webkit-scrollbar { display: none; }

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.vault-list { padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 12px; }

/* ---------- entry card ---------- */
.entry-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  width: 100%;
}
.entry-top { display: flex; align-items: center; gap: 10px; }
.entry-ico {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.entry-id { flex: 1; min-width: 0; }
.entry-name {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.entry-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 99px;
  margin-top: 4px;
}
.entry-actions { display: flex; gap: 2px; flex-shrink: 0; }
.secret-box {
  margin-top: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: ui-monospace, monospace;
  font-size: 14px;
  letter-spacing: 2px;
  min-height: 46px;
  display: flex;
  align-items: center;
  word-break: break-all;
}
.secret-box.revealed { letter-spacing: 0; user-select: all; }
.entry-meta { margin-top: 10px; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.entry-url { color: var(--primary); text-decoration: none; font-weight: 600; word-break: break-all; }

/* ---------- empty ---------- */
.empty { text-align: center; padding: 48px 32px; }
.empty-ico { font-size: 56px; margin-bottom: 12px; }
.empty h3 { font-size: 18px; margin-bottom: 6px; }
.empty p { margin-bottom: 20px; }

/* ---------- bottom nav ---------- */
.bnav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 30;
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bnav-inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-around;
  min-height: 68px;
  padding: 0 16px;
}
.bnav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none;
  color: var(--muted);
  font-size: 12px; font-weight: 600;
  font-family: inherit;
  min-width: 64px; min-height: 56px;
  justify-content: center;
  cursor: pointer;
}
.bnav-item.active { color: var(--primary); }
.bnav-ico { font-size: 22px; }
.bnav-fab {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 30px;
  font-weight: 300;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(37, 99, 235, .4);
  cursor: pointer;
  margin-top: -20px;
}
.bnav-fab:active { transform: scale(.94); }

/* ---------- sheets ---------- */
.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(15, 23, 42, .45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  background: var(--card);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 640px;
  max-height: 92vh;
  overflow-y: auto;
  overflow-x: hidden;
  animation: sheet-in .28s cubic-bezier(.32, 1.2, .5, 1);
}
@keyframes sheet-in {
  from { transform: translateY(60px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.grab {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 99px;
  margin: 10px auto 0;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 2;
}
.sheet-head h3 { font-size: 17px; font-weight: 800; }
.sheet-body { padding: 16px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.sheet-sm { border-radius: 20px; margin: 0 16px 24px; max-width: 420px; }

@media (min-width: 700px) {
  .sheet-wrap { align-items: center; padding: 24px; }
  .sheet { border-radius: 20px; }
  .grab { display: none; }
}

/* ---------- forms ---------- */
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin: 14px 0 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.field-label:first-child { margin-top: 0; }
.input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  font-size: 16px; /* cegah iOS auto-zoom */
  font-family: inherit;
  color: var(--text);
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  outline: none;
  transition: border-color .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
textarea.input { resize: vertical; min-height: 72px; }
select.input { appearance: auto; }
.secret-input { display: flex; gap: 8px; }
.secret-input .input { flex: 1; min-width: 0; }

.row-2 { display: flex; gap: 10px; margin-top: 20px; }
.row-2 > * { flex: 1; }

.section-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 24px 0 4px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.section-title:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.section-title.danger { color: var(--danger); }

/* ---------- buttons ---------- */
.btn-primary, .btn-ghost, .btn-danger {
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: transform .08s, filter .15s;
}
.btn-primary:active, .btn-ghost:active, .btn-danger:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; margin-top: 16px; }
.btn-link {
  background: none; border: none;
  color: var(--primary);
  font-size: 14px; font-weight: 600;
  font-family: inherit;
  margin-top: 16px;
  cursor: pointer;
  min-height: 44px;
}
.icon-btn {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn:active { transform: scale(.92); }
.act-btn {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none;
  font-size: 20px;
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
}
.act-btn:active { background: var(--bg); transform: scale(.9); }
.act-btn.copied { font-size: 18px; }

/* ---------- confirm ---------- */
.cf-body { text-align: center; }
.cf-ico { font-size: 44px; margin-bottom: 8px; }
.cf-body h3 { font-size: 18px; margin-bottom: 6px; }
.cf-body p { font-size: 14px; margin-bottom: 20px; }

/* ---------- wipe ---------- */
.wipe-hero {
  text-align: center;
  padding: 24px 20px 16px;
  background: var(--danger-soft);
  border-bottom: 1px solid #FECACA;
}
.wipe-icon { font-size: 44px; margin-bottom: 8px; }
.wipe-hero h3 { color: var(--danger); font-size: 19px; margin-bottom: 6px; }
.wipe-hero p { font-size: 13.5px; color: var(--muted); }
.wipe-hero b { color: var(--danger); }
.wipe-input {
  text-align: center;
  font-size: 24px !important;
  letter-spacing: 10px;
  font-weight: 800;
}
.wipe-input::placeholder { letter-spacing: 6px; opacity: .4; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}
.shake { animation: shake .3s ease; }

/* ---------- custom cats ---------- */
.cat-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.cat-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 8px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.cat-row .cat-ico {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.cat-row span { flex: 1; font-weight: 600; font-size: 14px; }
.cat-add { display: flex; flex-direction: column; gap: 8px; }
.cat-pick-row { display: flex; gap: 8px; align-items: center; }
.cat-pick-row select { width: 76px; flex-shrink: 0; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.swatch {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 2px solid transparent;
  cursor: pointer;
}
.swatch.sel { border-color: var(--text); }

/* ---------- toasts ---------- */
.toasts {
  position: fixed;
  bottom: calc(96px + env(safe-area-inset-bottom));
  left: 16px; right: 16px;
  z-index: 100;
  display: flex; flex-direction: column; gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
  transform: translateY(16px);
  opacity: 0;
  transition: all .3s ease;
  max-width: 100%;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--danger); }

/* === Kartu compact expandable === */
.entry-card {
  padding: 0;
  overflow: hidden;
}
.entry-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  min-height: 44px;
}
.entry-head:active { background: rgba(0,0,0,.03); }
.entry-card.open .entry-head { border-bottom: 1px solid var(--border); }
.chev {
  color: var(--muted);
  font-size: 14px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}
.entry-detail {
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: slideDown .2s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.mini-btn {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
}
.mini-btn:active { transform: scale(.97); }
.mini-btn.danger { color: #dc2626; border-color: #fecaca; }
.detail-line {
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
}
.detail-line.muted { color: var(--muted); }
.detail-time {
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
}
.secret-val {
  font-family: monospace;
  font-size: 13px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  word-break: break-all;
  user-select: all;
}
.secret-val.masked { letter-spacing: 2px; }
