/* VaultKey — Glass Edition */
:root {
  --bg: #07070f;
  --glass: rgba(255,255,255,0.035);
  --glass-border: rgba(255,255,255,0.08);
  --glass-border-hover: rgba(255,255,255,0.14);
  --accent: #7c6cfc;
  --accent-dim: rgba(124,108,252,0.15);
  --accent-glow: rgba(124,108,252,0.4);
  --text: #e8e8f2;
  --text-muted: rgba(232,232,242,0.55);
  --text-dim: rgba(232,232,242,0.28);
  --border: rgba(255,255,255,0.07);
  --border-sub: rgba(255,255,255,0.04);
  --success: #4ecb88;
  --warning: #f0c040;
  --danger: #f06060;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --blur: blur(24px);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#app { height: 100vh; display: flex; flex-direction: column }

/* === AUTH === */
.auth-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  position: relative;
  overflow: hidden;
}

.auth-screen::before {
  content: '';
  position: absolute;
  width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(124,108,252,0.14) 0%, transparent 65%);
  top: 50%; left: 50%;
  transform: translate(-50%, -55%);
  pointer-events: none;
}

.auth-screen::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(78,203,136,0.06) 0%, transparent 65%);
  bottom: 0; right: 0;
  pointer-events: none;
}

.auth-key-visual {
  position: relative;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 40px rgba(124,108,252,0.55)) drop-shadow(0 0 80px rgba(124,108,252,0.2));
  animation: floatKey 4s ease-in-out infinite;
}

@keyframes floatKey {
  0%, 100% { transform: translateY(0) rotate(-2deg) }
  50% { transform: translateY(-8px) rotate(2deg) }
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  position: relative;
}

.auth-brand-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #d4ccff 0%, #7c6cfc 45%, #b8aeff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: rgba(255,255,255,0.03);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: var(--radius-lg);
  padding: 28px 26px;
  box-shadow: 0 40px 100px rgba(0,0,0,0.55), 0 0 0 1px rgba(124,108,252,0.07) inset;
  position: relative;
}

.auth-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 60%);
  pointer-events: none;
}

.auth-sub {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  line-height: 1.65;
  margin-bottom: 22px;
}

/* === FORM === */
.form-group { margin-bottom: 14px }
.form-label {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px }

.input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  -webkit-appearance: none;
}
.input::placeholder { color: var(--text-dim) }
.input:focus {
  background: rgba(255,255,255,0.055);
  border-color: rgba(124,108,252,0.5);
  box-shadow: 0 0 0 3px rgba(124,108,252,0.1), 0 0 30px rgba(124,108,252,0.07);
}
textarea.input { resize: vertical; min-height: 80px }
select.input { cursor: pointer }

.input-wrap { position: relative; display: flex; align-items: center }
.input-wrap .input { padding-right: 40px }
.input-suffix { position: absolute; right: 6px; top: 50%; transform: translateY(-50%) }

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.23,1,0.32,1);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
  position: relative;
}
.btn-full { width: 100% }
.btn-sm { padding: 8px 13px; font-size: 12.5px }

.btn-primary {
  background: linear-gradient(135deg, #8a7dfd 0%, #5e4fd4 100%);
  color: #fff;
  box-shadow: 0 4px 24px rgba(124,108,252,0.4), 0 1px 0 rgba(255,255,255,0.12) inset;
  letter-spacing: 0.02em;
}
.btn-primary:hover { box-shadow: 0 6px 32px rgba(124,108,252,0.55), 0 1px 0 rgba(255,255,255,0.12) inset; transform: translateY(-1px) }
.btn-primary:active { transform: translateY(0); box-shadow: 0 2px 14px rgba(124,108,252,0.35) }

.btn-secondary {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.09);
  color: var(--text);
}
.btn-secondary:hover { background: rgba(255,255,255,0.09); border-color: rgba(255,255,255,0.14) }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,0.04) }

.btn-danger {
  background: rgba(240,96,96,0.12);
  border: 1px solid rgba(240,96,96,0.3);
  color: var(--danger);
}
.btn-danger:hover { background: rgba(240,96,96,0.2) }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.icon-btn:hover { background: rgba(255,255,255,0.07); color: var(--text) }
.icon-btn.danger:hover { color: var(--danger); background: rgba(240,96,96,0.1) }

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

/* === HEADER === */
.app-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: 54px;
  background: rgba(7,7,15,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.header-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #c4b8ff 0%, #7c6cfc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-search { flex: 1; min-width: 0; max-width: 300px }
.search-wrap { position: relative }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-dim) }
.search-input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  padding: 7px 12px 7px 32px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input::placeholder { color: var(--text-dim) }
.search-input:focus { border-color: rgba(124,108,252,0.4); box-shadow: 0 0 0 2px rgba(124,108,252,0.08) }

/* === LAYOUT === */
.layout { display: flex; flex: 1; overflow: hidden }

/* === SIDEBAR === */
.sidebar {
  width: 218px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: rgba(5,5,12,0.6);
  overflow-y: auto;
  transition: transform 0.25s cubic-bezier(0.32,0.72,0,1);
}
.sidebar-section { padding: 10px 8px }
.sidebar-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0 8px 7px;
}
.sidebar-sep { height: 1px; background: var(--border); margin: 0 8px }
.sidebar-bottom { padding: 10px 8px; margin-top: auto; border-top: 1px solid var(--border) }

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text) }
.nav-item.active {
  background: rgba(124,108,252,0.1);
  color: #a89cff;
  box-shadow: inset 0 0 0 1px rgba(124,108,252,0.2);
}
.nav-item .count {
  margin-left: auto;
  font-size: 11px;
  background: rgba(255,255,255,0.06);
  padding: 1px 6px;
  border-radius: 10px;
  color: var(--text-dim);
}
.nav-item.active .count { background: rgba(124,108,252,0.18); color: #a89cff }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: 40;
}

/* === ENTRY LIST === */
.entry-list-panel {
  width: 272px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: rgba(8,8,18,0.5);
  overflow: hidden;
}
.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-title { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted) }
.panel-count {
  font-size: 11px;
  background: rgba(255,255,255,0.06);
  padding: 2px 7px;
  border-radius: 10px;
  color: var(--text-dim);
  margin-left: auto;
}

.entry-list { flex: 1; overflow-y: auto; padding: 6px }

.entry-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  margin-bottom: 2px;
  animation: fadeUp 0.2s both;
}
@keyframes fadeUp { from { opacity:0; transform:translateY(5px) } to { opacity:1; transform:none } }

.entry-card:hover { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.06) }
.entry-card.active {
  background: rgba(124,108,252,0.08);
  border-color: rgba(124,108,252,0.22);
  box-shadow: 0 0 0 1px rgba(124,108,252,0.1) inset;
}

.entry-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  border-radius: 9px;
  border: 1px solid rgba(255,255,255,0.06);
}
.entry-info { flex: 1; min-width: 0 }
.entry-name { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.entry-sub { font-size: 11.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 48px 16px;
  color: var(--text-dim);
  font-size: 13px;
}
.empty-state svg { opacity: 0.25; width: 26px; height: 26px }

/* === DETAIL PANEL === */
.detail-panel {
  flex: 1;
  overflow-y: auto;
  padding: 22px 26px;
  background: rgba(6,6,14,0.35);
}
.back-btn {
  display: none;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-muted);
  width: auto;
  padding: 6px 10px;
  margin-bottom: 10px;
}
.no-selection {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--text-dim);
  font-size: 13px;
}
.no-selection svg { opacity: 0.18; width: 36px; height: 36px }

.detail-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.detail-icon {
  font-size: 28px;
  width: 52px; height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(124,108,252,0.08);
  border: 1px solid rgba(124,108,252,0.16);
  border-radius: 14px;
  flex-shrink: 0;
}
.detail-title { font-size: 17px; font-weight: 600; color: var(--text) }
.detail-category {
  font-size: 10.5px;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: 10px;
  display: inline-block;
  margin-top: 4px;
  letter-spacing: 0.06em;
  border: 1px solid rgba(124,108,252,0.2);
}
.detail-actions { margin-left: auto; display: flex; gap: 4px }

.detail-fields { display: flex; flex-direction: column; gap: 4px }

.field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.055);
  border-radius: 10px;
  transition: border-color 0.15s, background 0.15s;
}
.field-row:hover { background: rgba(255,255,255,0.035); border-color: rgba(255,255,255,0.09) }
.field-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  width: 88px;
  flex-shrink: 0;
}
.field-value { flex: 1; font-size: 13.5px; color: var(--text); word-break: break-all; min-width: 0 }
.field-value a { color: var(--accent); text-decoration: none }
.field-value a:hover { text-decoration: underline }
.field-value.mono { font-family: 'SF Mono','Fira Code',monospace; letter-spacing: 0.02em }
.field-actions { display: flex; gap: 2px; flex-shrink: 0 }

.notes-block {
  padding: 14px;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.055);
  border-radius: 10px;
  margin-top: 4px;
}
.notes-block pre { font-family: inherit; white-space: pre-wrap; word-break: break-word; font-size: 13px; color: var(--text-muted); line-height: 1.65 }

.tags-row { display: flex; flex-wrap: wrap; gap: 5px }
.tag-chip {
  font-size: 11px;
  background: rgba(124,108,252,0.1);
  border: 1px solid rgba(124,108,252,0.22);
  color: #a89cff;
  padding: 2px 8px;
  border-radius: 10px;
}

.totp-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: rgba(78,203,136,0.1);
  border: 1px solid rgba(78,203,136,0.25);
  color: var(--success);
  padding: 2px 6px;
  border-radius: 6px;
}

/* === MODAL === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
  animation: fadeIn 0.15s;
}
@keyframes fadeIn { from { opacity:0 } to { opacity:1 } }

.modal {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  background: rgba(10,10,20,0.96);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  box-shadow: 0 40px 100px rgba(0,0,0,0.65), 0 0 0 1px rgba(124,108,252,0.09) inset;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalUp 0.22s cubic-bezier(0.23,1,0.32,1);
}
@keyframes modalUp { from { opacity:0; transform:scale(0.95) translateY(10px) } to { opacity:1; transform:none } }

.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0 }
.modal-title { font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 7px }
.modal-body { flex: 1; overflow-y: auto; padding: 20px }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); flex-shrink: 0 }

/* === TOAST === */
.toast-container { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 500 }
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(14,14,26,0.96);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  animation: toastIn 0.2s cubic-bezier(0.23,1,0.32,1);
}
@keyframes toastIn { from { opacity:0; transform:translateX(20px) } to { opacity:1; transform:none } }
.toast.fade-out { opacity:0; transform:translateX(8px); transition:all 0.2s }
.toast.success { border-color: rgba(78,203,136,0.3); color: var(--success) }
.toast.error { border-color: rgba(240,96,96,0.3); color: var(--danger) }

/* === GENERATOR === */
.gen-output {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  background: rgba(124,108,252,0.06);
  border: 1px solid rgba(124,108,252,0.2);
  border-radius: 10px;
  margin-bottom: 10px;
}
.gen-password { flex: 1; font-family: 'SF Mono','Fira Code',monospace; font-size: 15px; word-break: break-all; color: var(--text); letter-spacing: 0.06em }

.range-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px }
.range-label { font-size: 12px; color: var(--text-muted); width: 50px }
.range-row input[type=range] { flex:1; accent-color: var(--accent) }
.range-val { font-size: 13px; font-weight: 600; width: 28px; text-align: right }

.toggle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px }
.toggle-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 9px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
  user-select: none;
}
.toggle-item input { display:none }
.toggle-item:hover { border-color: rgba(255,255,255,0.12) }
.toggle-item.active { background: rgba(124,108,252,0.1); border-color: rgba(124,108,252,0.3); color: #a89cff }

/* === STRENGTH === */
.pw-strength { margin-top: 6px; display: flex; align-items: center; gap: 8px }
.pw-strength-row { display: flex; gap: 4px }
.pw-seg { width: 26px; height: 3px; border-radius: 2px; background: rgba(255,255,255,0.08); transition: background 0.3s }

/* === SYNC === */
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); transition: background 0.3s; flex-shrink: 0 }
.sync-dot.ok { background: var(--success); box-shadow: 0 0 6px var(--success) }
.sync-dot.syncing { background: var(--warning); animation: pulse 1s infinite }
.sync-dot.error { background: var(--danger) }
@keyframes pulse { 0%,100%{opacity:1}50%{opacity:0.3} }

/* === SETTINGS === */
.settings-section { margin-bottom: 4px }
.settings-heading { font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 12px }
.text-small { font-size: 12px; color: var(--text-muted) }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 4px }
::-webkit-scrollbar-track { background: transparent }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.16) }

.menu-btn { display: none }

/* === MOBILE === */
@media (max-width: 767px) {
  .menu-btn { display: flex }
  .sidebar {
    position: fixed;
    left: -240px;
    top: 0; bottom: 0;
    width: 240px;
    z-index: 50;
    border-right: 1px solid var(--glass-border);
    background: rgba(6,6,14,0.97);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
  }
  .sidebar.open { left: 0 }
  .sidebar-overlay { display: block }
  .sidebar-overlay.show { display: block }
  .entry-list-panel { width: 100%; border-right: none }
  .detail-panel { display: none; position: fixed; inset: 0; z-index: 30; background: rgba(7,7,15,0.99); padding: 16px }
  .detail-panel.mobile-show { display: block; overflow-y: auto }
  .back-btn { display: flex }
  .header-search { display: none }
  .form-row { grid-template-columns: 1fr }
  .auth-card { padding: 22px 18px }
  .auth-brand-text { font-size: 17px; letter-spacing: 0.28em }
}
