/* ============================================================
   STYLE.CSS — VAULT Password Manager v6
   Premium dark UI with glassmorphism & animations
   ============================================================ */

/* ── Google Fonts via <link> in HTML ────────────────────── */

/* ── Design Tokens ────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg: #060a12;
  --surface: #0c1220;
  --surface2: #101827;
  --surface3: #141e2e;
  --glass: rgba(12, 18, 32, 0.72);

  /* Borders */
  --border: #19263a;
  --border2: #1f3050;
  --border3: #253a58;

  /* Accent colors */
  --accent: #3effd0;
  --accent-dim: rgba(62, 255, 208, 0.08);
  --accent-glow: rgba(62, 255, 208, 0.22);
  --accent-mid: rgba(62, 255, 208, 0.45);

  /* Other colors */
  --purple: #a78bfa;
  --purple-dim: rgba(167, 139, 250, 0.10);
  --purple-glow: rgba(167, 139, 250, 0.22);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.09);
  --yellow: #fbbf24;
  --green: #4ade80;
  --orange: #fb923c;

  /* Text */
  --text: #dde6f5;
  --text2: #94a8c0;
  --muted: #3d5068;
  --muted2: #6680a0;

  /* Typography */
  --fh: 'Syne', sans-serif;
  --fc: 'JetBrains Mono', monospace;
  --fb: 'Inter', sans-serif;

  /* Radii */
  --r: 14px;
  --rs: 9px;
  --rx: 20px;

  /* Shadows */
  --shadow-card: 0 4px 30px rgba(0, 0, 0, 0.5);
  --shadow-modal: 0 40px 80px rgba(0, 0, 0, 0.7);
}

/* ── Reset ────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--fb);
  overflow: hidden;
}

button {
  font-family: inherit;
}

input,
textarea,
select {
  font-family: inherit;
  color: inherit;
  background: transparent;
}

a {
  color: var(--accent);
  text-decoration: none;
}

::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border3);
}

/* ── Animations ───────────────────────────────────────────── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(22px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes orbFloat1 {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(-30px, 20px) scale(1.08);
  }
}

@keyframes orbFloat2 {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(25px, -18px) scale(1.12);
  }
}

@keyframes orbFloat3 {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(-15px, 25px) scale(0.95);
  }
}

@keyframes icoSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .5;
  }
}

@keyframes slideIn {
  from {
    transform: scaleX(0);
  }

  to {
    transform: scaleX(1);
  }
}

@keyframes shimmer {
  to {
    background-position: 200% center;
  }
}

.ico-svg {
  display: block;
  flex-shrink: 0;
}

.ico-spin-wrap {
  display: inline-flex;
  align-items: center;
}

.ico-spin-wrap .ico-svg {
  animation: icoSpin .75s linear infinite;
}

/* ── Login Background ─────────────────────────────────────── */
#login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  background: var(--bg);
  overflow: hidden;
}

.login-bg-anim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
}

.orb-1 {
  width: 500px;
  height: 500px;
  top: -150px;
  left: -100px;
  background: radial-gradient(circle, rgba(62, 255, 208, 0.18) 0%, transparent 70%);
  animation: orbFloat1 12s ease-in-out infinite;
}

.orb-2 {
  width: 400px;
  height: 400px;
  bottom: -100px;
  right: -80px;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.15) 0%, transparent 70%);
  animation: orbFloat2 15s ease-in-out infinite;
}

.orb-3 {
  width: 300px;
  height: 300px;
  top: 40%;
  left: 50%;
  background: radial-gradient(circle, rgba(62, 142, 255, 0.08) 0%, transparent 70%);
  animation: orbFloat3 18s ease-in-out infinite;
}

/* ── Login Layout ─────────────────────────────────────────── */
.login-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  padding: 24px;
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.logo-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, rgba(62, 255, 208, 0.15) 0%, rgba(62, 142, 255, 0.08) 100%);
  border: 1px solid rgba(62, 255, 208, 0.3);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  box-shadow: 0 0 60px var(--accent-glow), 0 0 120px rgba(62, 255, 208, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.login-logo h1 {
  font-family: var(--fh);
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 1;
  background: linear-gradient(135deg, #fff 0%, var(--text2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-logo h1 em {
  -webkit-text-fill-color: var(--accent);
  font-style: normal;
}

.login-logo p {
  color: var(--muted2);
  font-size: 13px;
  margin-top: 8px;
  line-height: 1.5;
}

.login-card {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  padding: 32px;
  box-shadow: var(--shadow-modal), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.login-card h2 {
  font-family: var(--fh);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text);
}

.h-with-ico {
  display: flex;
  align-items: center;
  gap: 10px;
}

.h-with-ico .h-ico {
  display: flex;
  align-items: center;
  color: var(--accent);
  flex-shrink: 0;
}

/* ── Form elements (shared) ───────────────────────────────── */
.field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  display: block;
}

.field-wrap {
  position: relative;
  margin-bottom: 16px;
}

.field-prefix-ico {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted2);
  pointer-events: none;
  display: flex;
}

.field-wrap input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 13px 46px 13px 40px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}

.field-wrap input[type="password"] {
  font-family: var(--fc);
  letter-spacing: 3px;
}

.field-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  background: var(--surface3);
}

.field-wrap input::placeholder {
  color: var(--muted);
}

.eye-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 5px;
  transition: color .2s;
  display: flex;
  align-items: center;
}

.eye-btn:hover {
  color: var(--accent);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--rs);
  font-family: var(--fh);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: .3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, #00e5b6 100%);
  color: #040c18;
  box-shadow: 0 4px 24px var(--accent-glow), 0 1px 0 rgba(255, 255, 255, 0.15) inset;
  transition: opacity .2s, box-shadow .2s, transform .1s;
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  transform: translateX(-100%);
  transition: transform .5s;
}

.btn-primary:hover::before {
  transform: translateX(100%);
}

.btn-primary:hover {
  box-shadow: 0 6px 36px rgba(62, 255, 208, 0.45);
}

.btn-primary:active {
  transform: scale(.99);
}

.btn-primary:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.login-hint {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--purple-dim);
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: var(--rs);
  font-size: 12px;
  color: var(--muted2);
  line-height: 1.6;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.login-hint strong {
  color: var(--purple);
}

.login-error {
  margin-bottom: 14px;
  padding: 11px 14px;
  background: var(--red-dim);
  border: 1px solid rgba(248, 113, 113, 0.28);
  border-radius: var(--rs);
  color: var(--red);
  font-size: 12.5px;
  display: none;
  line-height: 1.5;
}

.db-status-bar {
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.db-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.db-dot.ok {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

.db-dot.warn {
  background: var(--yellow);
}

.db-dot.err {
  background: var(--red);
}

/* ── App Layout ───────────────────────────────────────────── */
#app {
  display: none;
  height: 100vh;
}

.layout {
  display: grid;
  grid-template-columns: 265px 1fr;
  height: 100%;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 16px;
}

.sidebar-logo-ico {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, rgba(62, 255, 208, 0.14) 0%, rgba(62, 142, 255, 0.07) 100%);
  border: 1px solid rgba(62, 255, 208, 0.22);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.sidebar-logo span:not(.sidebar-badge) {
  font-family: var(--fh);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -.5px;
  flex: 1;
}

.sidebar-logo span em {
  color: var(--accent);
  font-style: normal;
}

.sidebar-badge {
  font-family: var(--fc);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  background: var(--accent-dim);
  border: 1px solid rgba(62, 255, 208, 0.2);
  border-radius: var(--rx);
  color: var(--accent);
  letter-spacing: .5px;
  flex-shrink: 0;
}

.search-box {
  position: relative;
}

.search-box input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 9px 32px 9px 34px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color .2s, background .2s;
}

.search-box input:focus {
  border-color: rgba(62, 255, 208, 0.4);
  background: var(--surface3);
}

.search-box input::placeholder {
  color: var(--muted);
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  display: flex;
}

.search-clear {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color .15s;
}

.search-clear:hover {
  color: var(--text);
}

/* ── Nav ──────────────────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.nav-section-label {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 0 8px;
  margin: 14px 0 4px;
}

.nav-section-label:first-child {
  margin-top: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: var(--rs);
  cursor: pointer;
  color: var(--muted2);
  font-size: 13px;
  transition: all .15s;
  margin-bottom: 1px;
  user-select: none;
  border: 1px solid transparent;
  position: relative;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(62, 255, 208, 0.15);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 20%;
  bottom: 20%;
  width: 2px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-ico {
  width: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}

.nav-ico-roblox {
  color: #f87171;
}

.nav-ico-discord {
  color: #a5b4fc;
}

.nav-ico-email {
  color: #fca5a5;
}

.nav-ico-social {
  color: #93c5fd;
}

.nav-ico-game {
  color: var(--yellow);
}

.nav-ico-2fa {
  color: var(--accent);
}

.nav-ico-cookie {
  color: var(--orange);
}

.nav-count {
  margin-left: auto;
  background: var(--surface3);
  color: var(--muted2);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--rx);
  font-family: var(--fc);
  min-width: 22px;
  text-align: center;
}

.nav-item.active .nav-count {
  background: rgba(62, 255, 208, 0.12);
  color: var(--accent);
}

/* ── Sidebar Footer ───────────────────────────────────────── */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-action-btn {
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--rs);
  color: var(--muted2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all .15s;
}

.sidebar-action-btn:hover {
  border-color: var(--border3);
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.lock-btn {
  width: 100%;
  padding: 10px;
  background: var(--red-dim);
  border: 1px solid rgba(248, 113, 113, 0.2);
  border-radius: var(--rs);
  color: var(--red);
  font-family: var(--fh);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all .15s;
}

.lock-btn:hover {
  background: rgba(248, 113, 113, 0.16);
  border-color: rgba(248, 113, 113, 0.35);
}

/* ── Main ─────────────────────────────────────────────────── */
.main {
  overflow-y: auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.main-header {
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(6, 10, 18, .88);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
}

.main-header h2 {
  font-family: var(--fh);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.5px;
}

.main-header h2 span {
  color: var(--muted2);
  font-weight: 400;
  font-size: 13px;
  margin-left: 8px;
  font-family: var(--fb);
}

.add-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  background: linear-gradient(135deg, var(--accent) 0%, #00d4b0 100%);
  color: #040c18;
  border: none;
  border-radius: var(--rs);
  font-family: var(--fh);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px var(--accent-glow);
  flex-shrink: 0;
  transition: box-shadow .2s, transform .1s;
}

.add-btn:hover {
  box-shadow: 0 6px 28px rgba(62, 255, 208, 0.42);
}

.add-btn:active {
  transform: scale(.98);
}

/* ── Stats Bar ────────────────────────────────────────────── */
.stats-bar {
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 28px;
  align-items: center;
  flex-shrink: 0;
  background: linear-gradient(90deg, rgba(62, 255, 208, 0.02) 0%, transparent 50%);
}

.stat {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted2);
  flex-shrink: 0;
}

.stat-num {
  font-family: var(--fc);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: 10px;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 1px;
}

.stat-security {
  margin-left: auto;
}

.stat-security .stat-icon {
  background: rgba(74, 222, 128, 0.08);
  border-color: rgba(74, 222, 128, 0.18);
}

/* ── Accounts grid ────────────────────────────────────────── */
.accounts-list {
  padding: 20px 28px;
  flex: 1;
}

.accounts-grid {
  display: grid;
  gap: 10px;
}

/* ── Account Card ─────────────────────────────────────────── */
.acc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s, transform .15s;
  position: relative;
}

.acc-card:hover {
  border-color: var(--border2);
  box-shadow: 0 6px 32px rgba(0, 0, 0, 0.4);
}

/* Category accent */
.acc-card.roblox {
  border-left: 3px solid #ef4444;
}

.acc-card.discord {
  border-left: 3px solid #5865f2;
}

.acc-card.email {
  border-left: 3px solid #ea4335;
}

.acc-card.social {
  border-left: 3px solid #1877f2;
}

.acc-card.game {
  border-left: 3px solid var(--yellow);
}

.acc-card.other {
  border-left: 3px solid var(--muted);
}

.acc-header {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
}

.acc-header:hover {
  background: rgba(255, 255, 255, 0.02);
}

.acc-avatar {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted2);
}

.acc-card.roblox .acc-avatar {
  color: #f87171;
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
}

.acc-card.discord .acc-avatar {
  color: #a5b4fc;
  background: rgba(88, 101, 242, 0.1);
  border-color: rgba(88, 101, 242, 0.2);
}

.acc-card.email .acc-avatar {
  color: #fca5a5;
  background: rgba(234, 67, 53, 0.08);
  border-color: rgba(234, 67, 53, 0.2);
}

.acc-card.social .acc-avatar {
  color: #93c5fd;
  background: rgba(24, 119, 242, 0.08);
  border-color: rgba(24, 119, 242, 0.2);
}

.acc-card.game .acc-avatar {
  color: var(--yellow);
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.2);
}

.acc-info {
  flex: 1;
  min-width: 0;
}

.acc-name {
  font-family: var(--fh);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acc-user {
  font-size: 12px;
  color: var(--muted2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.acc-badges {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.badge {
  font-size: 9.5px;
  padding: 2px 7px;
  border-radius: var(--rx);
  font-weight: 700;
  letter-spacing: .4px;
  font-family: var(--fc);
}

.badge-2fa {
  background: rgba(62, 255, 208, 0.09);
  color: var(--accent);
  border: 1px solid rgba(62, 255, 208, 0.22);
}

.badge-cookie {
  background: rgba(251, 146, 60, 0.09);
  color: var(--orange);
  border: 1px solid rgba(251, 146, 60, 0.22);
}

.acc-arrow {
  color: var(--muted);
  transition: transform .25s ease;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.acc-card.expanded .acc-arrow {
  transform: rotate(180deg);
}

.acc-body {
  display: none;
  border-top: 1px solid var(--border);
  animation: fadeUp .2s ease;
  overflow: hidden;
}

.acc-card.expanded .acc-body {
  display: block;
}

.acc-fields {
  padding: 14px 16px;
  display: grid;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-key {
  font-size: 10px;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: .9px;
  font-weight: 600;
}

.field-val {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 8px 10px;
  transition: border-color .15s;
}

.field-val:hover {
  border-color: var(--border2);
}

.field-text {
  flex: 1;
  min-width: 0;
  font-family: var(--fc);
  font-size: 12.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-text.hidden {
  letter-spacing: 3px;
  color: var(--muted2);
  font-family: var(--fc);
}

.field-text.cookie-text.hidden {
  letter-spacing: 2px;
  font-size: 11px;
}

/* Cookie revealed: break long string instead of overflowing */
.field-text.cookie-text:not(.hidden) {
  white-space: pre-wrap;
  word-break: break-all;
  overflow-wrap: anywhere;
  font-size: 11px;
  line-height: 1.5;
  align-self: flex-start;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 5px;
  transition: color .15s, transform .1s;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.icon-btn:hover {
  color: var(--accent);
}

.icon-btn:active {
  transform: scale(.9);
}

.icon-btn.copied {
  color: var(--accent);
}

/* ── TOTP Widget ──────────────────────────────────────────── */
.totp-widget {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.totp-label {
  font-size: 9.5px;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 5px;
}

.totp-code {
  font-family: var(--fc);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--accent);
  transition: color .3s;
}

.totp-code.is-error {
  letter-spacing: 1.5px;
  font-size: 20px;
}

.totp-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.timer-ring {
  position: relative;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.timer-ring svg {
  display: block;
}

.ring-track {
  fill: none;
  stroke: var(--border2);
  stroke-width: 2.5;
}

.ring-prog {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear, stroke .3s;
}

.ring-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--fc);
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
}

/* ── Card actions ─────────────────────────────────────────── */
.acc-actions {
  padding: 0 16px 14px;
  display: flex;
  gap: 7px;
}

.btn-edit {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--rs);
  color: var(--muted2);
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-edit:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.btn-delete {
  padding: 6px 14px;
  background: var(--red-dim);
  border: 1px solid rgba(248, 113, 113, 0.18);
  border-radius: var(--rs);
  color: var(--red);
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-delete:hover {
  background: rgba(248, 113, 113, 0.18);
  border-color: rgba(248, 113, 113, 0.4);
}

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 90px 20px;
}

.empty-state .big-icon {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  opacity: .3;
}

.empty-state h3 {
  font-family: var(--fh);
  font-size: 20px;
  color: var(--muted2);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.65;
}

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 18, .85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  width: 100%;
  max-width: 580px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 26px;
  box-shadow: var(--shadow-modal), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transform: scale(.95) translateY(12px);
  transition: transform .25s cubic-bezier(.16, 1, .3, 1);
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-family: var(--fh);
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: var(--surface2);
  border: 1px solid var(--border);
  width: 32px;
  height: 32px;
  border-radius: var(--rs);
  color: var(--muted2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}

.modal-close:hover {
  color: var(--red);
  border-color: rgba(248, 113, 113, 0.35);
  background: var(--red-dim);
}

/* ── Form ─────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  gap: 14px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 11px;
  color: var(--muted2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
}

.required-star {
  color: var(--accent);
  margin-left: 2px;
}

.form-group input,
.form-group textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 10px 13px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  background: var(--surface3);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--muted);
}

.form-group textarea {
  resize: vertical;
  min-height: 70px;
  font-size: 13px;
  line-height: 1.55;
}

.form-hint {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.6;
}

.pass-wrap {
  position: relative;
}

.pass-wrap input {
  padding-right: 44px;
  font-family: var(--fc);
  letter-spacing: 1px;
}

.pass-toggle {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  transition: color .2s;
}

.pass-toggle:hover {
  color: var(--accent);
}

.separator {
  height: 1px;
  background: var(--border);
}

.section-label-plain {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--fh);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted2);
  margin: 2px 0;
}

/* ── Type Selector ────────────────────────────────────────── */
.type-selector {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
}

.type-opt {
  padding: 10px 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  font-size: 11.5px;
  color: var(--muted2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.type-opt:hover {
  border-color: var(--border2);
  color: var(--text);
}

.type-opt.selected {
  background: var(--accent-dim);
  border-color: rgba(62, 255, 208, 0.3);
  color: var(--accent);
  font-weight: 600;
}

.type-opt-ico {
  display: flex;
  align-items: center;
  color: inherit;
}

/* ── Cookie Card ──────────────────────────────────────────── */
.cookie-card.form-group {
  padding: 0;
  gap: 0;
  overflow: hidden;
  border-radius: var(--r);
  border: 1px solid rgba(251, 146, 60, 0.25);
  background: linear-gradient(150deg, rgba(251, 146, 60, 0.05) 0%, var(--surface2) 50%);
}

.cookie-card-head {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.cookie-card-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(251, 146, 60, 0.1);
  border: 1px solid rgba(251, 146, 60, 0.25);
  color: var(--orange);
}

.cookie-card-title {
  font-family: var(--fh);
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 4px;
}

.cookie-card-desc {
  font-size: 11.5px;
  color: var(--muted2);
  line-height: 1.55;
}

.cookie-field-label {
  display: block;
  padding: 11px 16px 5px;
  font-size: 11px;
  color: var(--muted2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .7px;
}

.cookie-textarea {
  margin: 0 16px 12px;
  width: calc(100% - 32px);
  min-height: 88px;
  resize: vertical;
  background: var(--surface3) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--rs) !important;
  padding: 10px 12px !important;
  font-family: var(--fc) !important;
  font-size: 11px !important;
  line-height: 1.5 !important;
}

.cookie-textarea:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-dim) !important;
  outline: none !important;
}

.cookie-warn {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin: 0 16px 16px;
  padding: 10px 12px;
  background: var(--red-dim);
  border: 1px solid rgba(248, 113, 113, 0.22);
  border-radius: var(--rs);
  font-size: 11.5px;
  color: #fecaca;
  line-height: 1.55;
}

/* ── TOTP Live row in modal ───────────────────────────────── */
.totp-live-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--rs);
}

.totp-live-label {
  font-size: 10px;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: .6px;
}

.totp-live-code {
  font-family: var(--fc);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 5px;
  color: var(--accent);
}

.totp-live-hint {
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
}

/* ── Cookie detail in card ────────────────────────────────── */
.field-key-cookie {
  display: flex;
  align-items: center;
  gap: 7px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  color: var(--muted2);
}

.field-key-cookie .ico-svg {
  color: var(--orange);
  flex-shrink: 0;
}

.cookie-detail-hint {
  font-size: 11px;
  color: var(--muted);
  margin: -2px 0 6px;
}

.cookie-field-row .field-val {
  margin-top: 0;
  flex-wrap: wrap;
  align-items: flex-start;
}

.cookie-field-row .field-val .icon-btn {
  flex-shrink: 0;
}

/* ── Modal Footer ─────────────────────────────────────────── */
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.btn-cancel {
  padding: 9px 18px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--rs);
  color: var(--muted2);
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}

.btn-cancel:hover {
  color: var(--text);
  border-color: var(--border2);
}

.btn-save {
  padding: 9px 22px;
  border: none;
  border-radius: var(--rs);
  background: linear-gradient(135deg, var(--accent) 0%, #00d4b0 100%);
  color: #040c18;
  font-family: var(--fh);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: box-shadow .2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-save:hover {
  box-shadow: 0 6px 28px rgba(62, 255, 208, 0.42);
}

/* ── Confirm Modal ────────────────────────────────────────── */
.confirm-modal {
  max-width: 380px !important;
  text-align: center;
  padding: 36px 32px !important;
}

.confirm-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  background: var(--red-dim);
  border: 1px solid rgba(248, 113, 113, 0.28);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--red);
}

.confirm-modal h3 {
  font-family: var(--fh);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
}

.confirm-modal p {
  font-size: 13px;
  color: var(--muted2);
  line-height: 1.6;
  margin-bottom: 24px;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.confirm-ok {
  padding: 9px 20px;
  display: flex;
  align-items: center;
  gap: 7px;
}

/* ── Toast ────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 9999;
  padding: 12px 18px;
  border-radius: var(--rs);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateY(18px) scale(.96);
  opacity: 0;
  transition: all .28s cubic-bezier(.16, 1, .3, 1);
  background: var(--surface2);
  border: 1px solid rgba(62, 255, 208, 0.4);
  color: var(--accent);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(62, 255, 208, 0.08);
  pointer-events: none;
}

.toast.show {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.toast.error {
  border-color: rgba(248, 113, 113, 0.4);
  color: var(--red);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}

.toast.info {
  border-color: rgba(167, 139, 250, 0.4);
  color: var(--purple);
}