:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1f232c;
  --border: #2a2f3a;
  --text: #e8eaed;
  --text-dim: #9aa0ac;
  --accent: #5b8cff;
  --accent-dim: #2c3e6b;
  --danger: #ff6b6b;
  --success: #4cd97b;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.screen { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; }
.hidden { display: none !important; }

#auth-screen { align-items: center; padding: 24px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 400px;
}

h1 { font-size: 1.4rem; margin: 0 0 4px; letter-spacing: -0.02em; }
.subtitle { color: var(--text-dim); font-size: 0.85rem; margin: 0 0 24px; }

.tabs { display: flex; gap: 4px; background: var(--surface-2); border-radius: 8px; padding: 4px; margin-bottom: 20px; }
.tab-btn {
  flex: 1; padding: 8px; border: none; background: transparent; color: var(--text-dim);
  border-radius: 6px; cursor: pointer; font-size: 0.85rem; font-weight: 600;
}
.tab-btn.active { background: var(--accent); color: #fff; }

.tab-panel { display: none; flex-direction: column; gap: 14px; }
.tab-panel.active { display: flex; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; color: var(--text-dim); }
.hint { font-weight: 400; color: var(--text-dim); font-size: 0.75rem; }

input, textarea {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; color: var(--text); font-size: 0.9rem; font-family: inherit;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

button {
  cursor: pointer; border: none; border-radius: 8px; padding: 11px; font-size: 0.9rem;
  font-weight: 600; background: var(--accent); color: #fff; font-family: inherit;
}
button:hover { filter: brightness(1.1); }
.ghost-btn { background: transparent; border: 1px solid var(--border); color: var(--text); }

.error { color: var(--danger); font-size: 0.8rem; min-height: 1em; margin: 0; }
.footnote { color: var(--text-dim); font-size: 0.72rem; line-height: 1.5; margin-top: 20px; }

.strength-meter { height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.strength-meter .bar { height: 100%; width: 0%; background: var(--danger); transition: 0.2s; }

/* Vault screen */
#vault-screen { display: block; width: 100%; max-width: 560px; margin: 0 auto; padding: 24px; }
.vault-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.vault-toolbar { margin-bottom: 16px; }
#add-entry-btn { width: 100%; }

.entry-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.entry {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.entry-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.entry-issuer { font-weight: 600; font-size: 0.95rem; }
.entry-label { color: var(--text-dim); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-code {
  font-family: 'SF Mono', Consolas, monospace; font-size: 1.4rem; letter-spacing: 0.08em;
  cursor: pointer; user-select: all;
}
.entry-timer {
  width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; color: var(--text-dim); border: 2px solid var(--accent-dim); flex-shrink: 0;
}
.entry-timer.low { border-color: var(--danger); color: var(--danger); }
.entry-delete { background: transparent; color: var(--text-dim); padding: 4px 8px; font-size: 1rem; }
.entry-delete:hover { color: var(--danger); }

.empty-state { text-align: center; color: var(--text-dim); font-size: 0.85rem; margin-top: 40px; }

/* Modal */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex;
  align-items: center; justify-content: center; padding: 20px; z-index: 10;
}
.modal-content {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; width: 100%; max-width: 420px;
}
.modal-content h2 { margin: 0 0 16px; font-size: 1.1rem; }
#add-entry-form { display: flex; flex-direction: column; gap: 12px; }
.divider { text-align: center; color: var(--text-dim); font-size: 0.75rem; margin: 4px 0; }
.modal-actions { display: flex; gap: 10px; margin-top: 8px; }
.modal-actions button { flex: 1; }
