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

:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --surface2: #1a1a25;
  --border: #2a2a3a;
  --text: #e8e8f0;
  --text2: #8888a0;
  --accent: #6c8aff;
  --accent2: #4a6aee;
  --danger: #ff4a6a;
  --success: #4aff8a;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Public page ── */
.public-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  text-align: center;
}

.public-page h1 {
  font-size: 2.5rem;
  font-weight: 300;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.public-page .tagline {
  color: var(--text2);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.contact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.contact-list a {
  color: var(--accent);
  text-decoration: none;
  font-size: 1rem;
  transition: opacity 0.2s;
}

.contact-list a:hover { opacity: 0.8; }

.login-link {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  color: var(--border);
  text-decoration: none;
  font-size: 0.75rem;
  transition: color 0.3s;
}

.login-link:hover { color: var(--text2); }

/* ── Login page ── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
}

.login-box h2 {
  font-size: 1.3rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  text-align: center;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text2);
  margin-bottom: 0.4rem;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: var(--accent);
}

.btn {
  width: 100%;
  padding: 0.75rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 0.5rem;
}

.btn:hover { background: var(--accent2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.error-msg {
  color: var(--danger);
  font-size: 0.85rem;
  text-align: center;
  margin-top: 1rem;
  min-height: 1.2rem;
}

/* ── Vault dashboard ── */
.vault-page {
  max-width: 600px;
  margin: 0 auto;
  padding: 1.5rem;
  padding-bottom: 5rem;
}

.vault-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.vault-header h1 {
  font-size: 1.3rem;
  font-weight: 500;
}

.vault-header .logout-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 0.4rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}

.vault-header .logout-btn:hover { border-color: var(--danger); color: var(--danger); }

.vault-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}

.vault-section-header {
  padding: 1rem 1.25rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.vault-section-header h3 {
  font-size: 1rem;
  font-weight: 500;
}

.vault-section-header .chevron {
  transition: transform 0.2s;
  color: var(--text2);
}

.vault-section.open .chevron { transform: rotate(90deg); }

.vault-section-body {
  display: none;
  padding: 0 1.25rem 1.25rem;
}

.vault-section.open .vault-section-body { display: block; }

.vault-item {
  background: var(--surface2);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
}

.vault-item .label {
  font-size: 0.75rem;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.vault-item .value {
  font-size: 1rem;
  margin-top: 0.2rem;
  word-break: break-word;
}

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

.vault-item a:hover { text-decoration: underline; }

.vault-item .actions {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.5rem;
}

.vault-item .actions a {
  font-size: 0.85rem;
  padding: 0.3rem 0.75rem;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
}

/* ── Edit mode ── */
.edit-area {
  width: 100%;
  min-height: 120px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: monospace;
  font-size: 0.85rem;
  padding: 0.75rem;
  resize: vertical;
  outline: none;
}

.edit-area:focus { border-color: var(--accent); }

.edit-controls {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.edit-controls button {
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-save { background: var(--accent); color: #fff; }
.btn-cancel { background: var(--surface2); color: var(--text2); border: 1px solid var(--border) !important; }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 100;
}

.toast.show { opacity: 1; }

/* ── Setup page ── */
.setup-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.setup-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 500px;
}

.setup-box h2 { margin-bottom: 0.5rem; }
.setup-box .subtitle { color: var(--text2); font-size: 0.9rem; margin-bottom: 1.5rem; }

/* ── Mobile ── */
@media (max-width: 480px) {
  .public-page h1 { font-size: 1.8rem; }
  .login-box, .setup-box { padding: 2rem 1.5rem; }
  .vault-page { padding: 1rem; }
}
