@font-face {
  font-family: "Manrope";
  src: url("/fonts/Manrope.ttf") format("truetype");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --bg: #0b0912;
  --card: #13101d;
  --card-2: #191528;
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .12);
  --text: #efecf8;
  --muted: #8f89a3;
  --accent: #ac27f4;
  --accent-dark: #8e14db;
  --accent-soft: rgba(172, 39, 244, .16);
  --green: #36c97e;
  --amber: #f5a524;
  --red: #ff5c7a;
  --blue: #5aa9ff;
  --radius: 18px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100dvh;
  font: 500 15px/1.5 "Manrope", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
.sprite { position: absolute; }
.muted { color: var(--muted); }
.grow { flex: 1; }
.mono { font-family: var(--mono); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; flex: none; }

.ambient {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(900px 520px at 85% -8%, rgba(172, 39, 244, .20), transparent 60%),
    radial-gradient(700px 460px at -5% 105%, rgba(142, 20, 219, .16), transparent 60%);
}
#embers { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; transition: opacity .9s; }
#embers.off { opacity: 0; }

/* ---------- lock screen ---------- */
.lock { position: relative; z-index: 1; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.lock-card {
  width: min(420px, 100%);
  padding: 34px 30px 26px;
  background: linear-gradient(180deg, rgba(25, 21, 40, .86), rgba(19, 16, 29, .92));
  border: 1px solid var(--line-2);
  border-radius: 24px;
  backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8), 0 0 0 1px rgba(0, 0, 0, .4);
  display: flex; flex-direction: column; gap: 16px;
  animation: rise .7s var(--ease) both;
}
.lock-card h1 { margin: 0; font-size: 26px; letter-spacing: -.03em; font-weight: 750; text-align: center; }
.mark {
  width: 76px; height: 76px; margin: 0 auto 2px; border-radius: 24px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  box-shadow: 0 10px 40px -8px rgba(172, 39, 244, .75), inset 0 1px 0 rgba(255, 255, 255, .35);
  animation: breathe 3.6s ease-in-out infinite;
}
.mark svg { width: 40px; height: 40px; }
.mark.sm { width: 38px; height: 38px; border-radius: 12px; animation: none; }
.mark.sm svg { width: 22px; height: 22px; }
.lock-card.shake { animation: shake .45s var(--ease); }
.lock-card.leaving { animation: leave .55s var(--ease) forwards; }

@keyframes rise { from { opacity: 0; transform: translateY(26px) scale(.97); } }
@keyframes leave { to { opacity: 0; transform: translateY(-18px) scale(1.04); filter: blur(6px); } }
@keyframes breathe { 50% { box-shadow: 0 10px 56px -4px rgba(172, 39, 244, .95), inset 0 1px 0 rgba(255, 255, 255, .35); transform: translateY(-2px); } }
@keyframes shake { 20% { transform: translateX(-9px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }

/* ---------- fields ---------- */
.field { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; font-weight: 650; color: var(--muted); letter-spacing: .01em; }
.input-wrap { position: relative; display: flex; }
input[type="text"], input[type="password"], input[type="search"], input:not([type]), textarea {
  width: 100%;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 11px 14px;
  color: var(--text);
  font-size: 15px; font-weight: 550;
  outline: none;
  transition: border-color .2s, background .2s, box-shadow .25s;
}
input.mono { font-family: var(--mono); font-size: 14px; }
textarea { resize: vertical; min-height: 64px; }
input::placeholder, textarea::placeholder { color: #5f5977; font-weight: 500; }
input:hover, textarea:hover { border-color: rgba(255, 255, 255, .2); }
input:focus-visible, textarea:focus-visible { border-color: var(--accent); background: rgba(172, 39, 244, .07); box-shadow: 0 0 0 4px var(--accent-soft); }
.input-wrap input { padding-right: 46px; }
.input-wrap .icon-btn { position: absolute; right: 5px; top: 50%; translate: 0 -50%; }

.icon-btn {
  display: grid; place-items: center; width: 34px; height: 34px;
  background: transparent; border: 0; border-radius: 10px; color: var(--muted);
  transition: background .15s, color .15s, transform .25s var(--spring);
}
.icon-btn:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.icon-btn:active { transform: scale(.88); }
.icon-btn:focus-visible, .btn:focus-visible, .chip:focus-visible, .seg input:focus-visible + span {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.check { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--muted); cursor: pointer; user-select: none; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box { width: 20px; height: 20px; border-radius: 7px; border: 1.5px solid var(--line-2); display: grid; place-items: center; transition: all .25s var(--ease); }
.check .box::after { content: ""; width: 10px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; rotate: -45deg; translate: 0 -1px; scale: 0; transition: scale .25s var(--spring); }
.check input:checked + .box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .box::after { scale: 1; }
.check input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }

.error { margin: 0; min-height: 0; font-size: 13px; color: var(--red); font-weight: 600; }
.error:empty { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 700; font-size: 14.5px; letter-spacing: -.005em;
  transition: transform .3s var(--spring), background .2s, border-color .2s, box-shadow .3s, opacity .2s;
  position: relative; overflow: hidden;
}
.btn:active { transform: scale(.96); }
.btn.wide { width: 100%; height: 48px; font-size: 15.5px; }
.btn.primary { color: #fff; background: linear-gradient(145deg, var(--accent), var(--accent-dark)); box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn.primary:hover { box-shadow: 0 10px 22px -8px rgba(0, 0, 0, .75), inset 0 1px 0 rgba(255, 255, 255, .3); transform: translateY(-1px); }
.btn.primary:active { transform: scale(.96); }
.btn.ghost { background: rgba(255, 255, 255, .05); border-color: var(--line-2); color: var(--text); }
.btn.ghost:hover { background: rgba(255, 255, 255, .09); }
.btn.icon-only { width: 42px; padding: 0; }
.btn.danger { background: rgba(255, 92, 122, .1); border-color: rgba(255, 92, 122, .3); color: var(--red); }
.btn.danger:hover { background: rgba(255, 92, 122, .18); }
.btn.danger.armed { background: var(--red); color: #1a0509; border-color: var(--red); }
.btn.busy { pointer-events: none; opacity: .75; }
.btn.busy span::after { content: ""; display: inline-block; width: 14px; height: 14px; margin-left: 10px; vertical-align: -2px; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }

/* ---------- app shell ---------- */
#app { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: 22px 20px 80px; }
.top { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 6px 0 18px; }
.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -.03em; line-height: 1.15; }
.brand-name span { color: var(--muted); font-weight: 600; }
.stats { font-size: 12.5px; }
.stats b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.search {
  display: flex; align-items: center; gap: 10px; width: min(360px, 100%); height: 42px; padding: 0 12px 0 14px;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line-2); border-radius: 12px; color: var(--muted);
  transition: border-color .2s, box-shadow .25s, width .35s var(--ease);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); color: var(--accent); width: min(440px, 100%); }
.search input { border: 0; background: transparent; padding: 0; height: 100%; font-size: 14.5px; box-shadow: none !important; }
.search input:focus-visible { background: transparent; }
.search input::-webkit-search-cancel-button { display: none; }
kbd { font: 700 11px var(--mono); color: var(--muted); border: 1px solid var(--line-2); border-radius: 6px; padding: 2px 7px; }
.top-actions { display: flex; gap: 8px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; padding: 4px 0 20px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px;
  background: transparent; border: 1px solid var(--line-2); border-radius: 99px; color: var(--muted);
  font-size: 13.5px; font-weight: 650; transition: all .25s var(--ease);
}
.chip i { font-style: normal; font-size: 12px; opacity: .7; font-variant-numeric: tabular-nums; }
.chip:hover { color: var(--text); border-color: rgba(255, 255, 255, .22); }
.chip:active { transform: scale(.95); }
.chip.on { background: var(--accent-soft); border-color: rgba(172, 39, 244, .6); color: #e8c8ff; }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 16px; align-items: start; }
.card {
  --mx: 50%; --my: 0%;
  position: relative; padding: 18px 18px 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  isolation: isolate; transition: transform .45s var(--ease), border-color .3s;
}
.card::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; z-index: -1; pointer-events: none; opacity: 0;
  background: radial-gradient(360px circle at var(--mx) var(--my), rgba(172, 39, 244, .22), transparent 60%);
  transition: opacity .35s;
}
.card::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none; opacity: 0;
  background: radial-gradient(260px circle at var(--mx) var(--my), rgba(214, 120, 255, .85), transparent 65%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); mask-composite: exclude;
  transition: opacity .35s;
}
.card:hover { transform: translateY(-2px); }
.card:hover::before, .card:hover::after { opacity: 1; }
.card.flash { animation: flash 1.1s var(--ease); }
@keyframes flash { 0% { box-shadow: 0 0 0 0 rgba(172, 39, 244, .75); } 100% { box-shadow: 0 0 0 16px rgba(172, 39, 244, 0); } }

.card-head { display: flex; align-items: flex-start; gap: 12px; padding-bottom: 12px; }
.avatar {
  width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center;
  font-weight: 800; font-size: 16px; color: #fff; text-transform: uppercase;
  background: linear-gradient(145deg, hsl(var(--h) 70% 52%), hsl(calc(var(--h) + 38) 72% 40%));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28);
}
.card-title { min-width: 0; flex: 1; }
.card-title h3 { margin: 0; font-size: 17px; font-weight: 750; letter-spacing: -.025em; line-height: 1.25; overflow-wrap: anywhere; }
.card-title a {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%; font-size: 12.5px; color: var(--muted);
  text-decoration: none; transition: color .2s;
}
.card-title a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-title a:hover { color: #e0a8ff; }
.card-title a svg { width: 13px; height: 13px; }
.card-head .icon-btn { color: var(--muted); border: 1px solid var(--line); }
.card-head .icon-btn:hover { color: #fff; background: var(--accent); border-color: var(--accent); }

.acct { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 10px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); }
.acct-meta { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; min-height: 18px; }
.role { font-size: 12px; font-weight: 700; color: var(--text); letter-spacing: .01em; }
.env { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; }
.env.prod { color: #ff9db0; background: rgba(255, 92, 122, .14); }
.env.staging { color: #ffd08a; background: rgba(245, 165, 36, .14); }
.env.dev { color: #9dccff; background: rgba(90, 169, 255, .14); }
.age { font-size: 11.5px; color: var(--muted); margin-left: auto; transition: opacity .2s; }
.age.old { color: var(--amber); }
.acct-actions { position: absolute; right: 0; top: 6px; display: flex; gap: 2px; opacity: 0; translate: 6px 0; transition: opacity .2s, translate .3s var(--ease); }
.acct-actions .icon-btn { width: 28px; height: 28px; border-radius: 8px; }
.acct-actions .icon-btn.del:hover { color: var(--red); }
.acct:hover .acct-actions, .acct:focus-within .acct-actions { opacity: 1; translate: 0 0; }
.acct:hover .age, .acct:focus-within .age { opacity: 0; }

.secret {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-width: 0; height: 40px; padding: 0 8px 0 12px;
  background: rgba(255, 255, 255, .035); border: 1px solid var(--line); border-radius: 11px; text-align: left; overflow: hidden;
  transition: background .2s, border-color .25s, transform .3s var(--spring);
}
.secret:hover { background: rgba(172, 39, 244, .09); border-color: rgba(172, 39, 244, .4); }
.secret:active { transform: scale(.97); }
.secret .val { font-family: var(--mono); font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; letter-spacing: .01em; }
.secret .ico { position: relative; width: 16px; height: 16px; color: var(--muted); flex: none; }
.secret .ico svg { position: absolute; inset: 0; width: 16px; height: 16px; transition: transform .35s var(--spring), opacity .2s; }
.secret .ico .ok { opacity: 0; transform: scale(.3) rotate(-30deg); color: var(--green); }
.secret.copied { border-color: rgba(54, 201, 126, .6); background: rgba(54, 201, 126, .1); }
.secret.copied .ico .cp { opacity: 0; transform: scale(.3); }
.secret.copied .ico .ok { opacity: 1; transform: none; }
.secret::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(54, 201, 126, .35) 50%, transparent 80%); translate: -100% 0;
}
.secret.copied::after { animation: sweep .7s var(--ease); }
@keyframes sweep { 0% { opacity: 1; translate: -100% 0; } 100% { opacity: 0; translate: 100% 0; } }

.pw-cell { display: flex; gap: 6px; min-width: 0; }
.pw-cell .secret { flex: 1; }
.eye { flex: none; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255, 255, 255, .035); }
.eye:hover { border-color: var(--line-2); }
.eye.on { color: #e0a8ff; border-color: rgba(172, 39, 244, .5); background: var(--accent-soft); }
.note { grid-column: 1 / -1; margin: -2px 0 0; padding: 7px 11px; font-size: 12.5px; line-height: 1.45; color: var(--muted); background: rgba(245, 165, 36, .06); border: 1px solid rgba(245, 165, 36, .18); border-radius: 8px; overflow-wrap: anywhere; }

/* ---------- empty state ---------- */
.empty { display: grid; place-items: center; gap: 6px; padding: 90px 16px; text-align: center; color: var(--accent); animation: rise .6s var(--ease) both; }
.empty h2 { margin: 12px 0 0; color: var(--text); font-size: 22px; letter-spacing: -.03em; }
.empty p { margin: 0 0 14px; max-width: 34ch; }
.empty svg { animation: breathe 3.6s ease-in-out infinite; }

/* ---------- dialog ---------- */
dialog {
  width: min(560px, calc(100% - 24px)); margin: auto; padding: 0; color: var(--text);
  background: linear-gradient(180deg, #1b1630, #14101f); border: 1px solid var(--line-2); border-radius: 22px;
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, .8);
}
dialog[open] { animation: dlg-in .4s var(--ease); }
dialog.closing { animation: dlg-out .22s ease-in forwards; }
dialog::backdrop { background: rgba(6, 4, 12, .66); backdrop-filter: blur(6px); animation: fade .3s; }
dialog.closing::backdrop { animation: fade .22s reverse forwards; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(24px) scale(.95); } }
@keyframes dlg-out { to { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes fade { from { opacity: 0; } }
#editor-form { display: flex; flex-direction: column; gap: 16px; padding: 22px 24px 24px; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; }
.dlg-head h2 { margin: 0; font-size: 20px; font-weight: 750; letter-spacing: -.03em; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dlg-foot { display: flex; align-items: center; gap: 10px; padding-top: 4px; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line-2); border-radius: 13px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: grid; place-items: center; height: 34px; border-radius: 9px; font-size: 13.5px; font-weight: 700; color: var(--muted); transition: all .25s var(--ease); cursor: pointer; }
.seg input:checked + span { background: linear-gradient(145deg, var(--accent), var(--accent-dark)); color: #fff; box-shadow: 0 2px 8px -2px rgba(0, 0, 0, .6); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom)); z-index: 50; translate: -50% 0;
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 32px); padding: 11px 16px 11px 12px;
  background: rgba(32, 27, 50, .92); backdrop-filter: blur(14px); border: 1px solid var(--line-2); border-radius: 14px;
  font-size: 14px; font-weight: 650; box-shadow: 0 16px 50px -12px rgba(0, 0, 0, .8);
  opacity: 0; transform: translateY(18px) scale(.94); pointer-events: none; transition: opacity .25s, transform .45s var(--spring);
}
.toast.show { opacity: 1; transform: none; }
.toast .dot { width: 22px; height: 22px; display: grid; place-items: center; flex: none; border-radius: 50%; background: rgba(54, 201, 126, .18); color: var(--green); }
.toast.err .dot { background: rgba(255, 92, 122, .18); color: var(--red); }
.toast .dot svg { width: 13px; height: 13px; }
.toast small { color: var(--muted); font-weight: 600; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  #app { padding: 14px 14px 80px; }
  .top { gap: 12px; }
  .search { order: 3; width: 100%; }
  .search:focus-within { width: 100%; }
  .top-actions { margin-left: auto; }
  .row2 { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .acct-actions { opacity: 1; translate: 0 0; }
  .acct:hover .age { opacity: 1; }
  kbd { display: none; }
}
@media (max-width: 380px) {
  .acct { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (max-width: 480px) {
  #add { width: 42px; padding: 0; }
  #add span { display: none; }
  .toast { font-size: 13.5px; }
}

@media (max-width: 720px) {
  .acct-meta { padding-right: 30px; }
}

/* ---------- language switch ---------- */
.lang { display: inline-flex; align-items: center; gap: 2px; height: 42px; padding: 3px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line-2); border-radius: 12px; }
.lang button { height: 100%; padding: 0 11px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 750; letter-spacing: .04em; transition: background .2s, color .2s, transform .25s var(--spring); }
.lang button:hover { color: var(--text); }
.lang button:active { transform: scale(.92); }
.lang button.on { background: rgba(255, 255, 255, .1); color: var(--text); }
.lang button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.lang-lock { position: fixed; top: 16px; right: 16px; z-index: 2; height: 38px; }
.top-actions { align-items: center; }
@media (max-width: 480px) {
  .top-actions .lang { height: 42px; }
  .top-actions .lang button { padding: 0 8px; }
  .brand-name { font-size: 17px; }
}

/* ---------- login heading: logo beside the title ---------- */
.lock-head { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 4px 0 6px; }
.lock-head h1 { text-align: left; }
.lock-head .flame { color: var(--accent); animation: flame 3.6s ease-in-out infinite; }
@keyframes flame { 50% { transform: translateY(-2px) scale(1.06); } }

/* ---------- stats row above the cards ---------- */
.subbar { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; padding: 4px 0 20px; }
.subbar .chips { padding: 0; }
.subbar .stats { margin-left: auto; font-size: 13px; }
