:root {
  --bg: #0b0f19;
  --bg-soft: #121826;
  --border: #1f2937;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #22d3ee;
  --accent-2: #10b981;
  --danger: #ef4444;
  --radius: 10px;
  --shadow: 0 8px 24px rgba(0,0,0,.4);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  min-height: 100dvh;
}

body {
  display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.screen { flex: 1; display: flex; flex-direction: column; }

/* Lock */
#screen-lock {
  align-items: center; justify-content: center; padding: 1rem;
}
.card {
  width: min(420px, 100%);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}
.brand {
  margin: 0 0 .25rem;
  font-size: 1.75rem;
  letter-spacing: .18em;
  color: var(--accent);
  text-align: center;
}
.brand.small { font-size: .95rem; }

.vault-count {
  margin-left: 1rem;
  font-size: 0.8rem;
}

.muted { color: var(--muted); }
.small { font-size: .85rem; }

label {
  display: block; margin: 1rem 0 .35rem;
  font-size: .85rem; color: var(--muted);
}

input, textarea, button {
  font: inherit; color: inherit;
}
input[type="password"],
input[type="text"],
input[type="email"],
input[type="url"],
input[type="search"],
textarea {
  width: 100%;
  background: #0e1420;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .65rem .8rem;
  outline: none;
  transition: border-color .15s;
}
input:focus, textarea:focus { border-color: var(--accent); }

.input-row { display: flex; gap: .5rem; align-items: center; }
.input-row input { flex: 1; }

button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: #16202f;
  border-radius: 8px;
  padding: .65rem 1rem;
  transition: filter .15s, background .15s, border-color .15s;
}
button:hover { filter: brightness(1.1); }
button.primary {
  background: var(--accent); color: #062a30; border-color: transparent;
  font-weight: 600;
}
button.ghost { background: transparent; padding: .5rem .65rem; }
button.link {
  background: transparent; border: none; color: var(--accent);
  padding: .5rem; margin-top: .5rem; text-decoration: underline;
}

#form-unlock button[type="submit"] { width: 100%; margin-top: 1.25rem; }

.strength { margin-top: .5rem; }
.strength-bar {
  height: 6px; background: #0e1420; border-radius: 3px; overflow: hidden;
}
.strength-bar > div {
  height: 100%; width: 0%;
  background: var(--danger); transition: width .2s, background .2s;
}
.strength-0 { width: 10%; background: var(--danger) !important; }
.strength-1 { width: 30%; background: #f59e0b !important; }
.strength-2 { width: 60%; background: #fbbf24 !important; }
.strength-3 { width: 80%; background: #10b981 !important; }
.strength-4 { width: 100%; background: var(--accent-2) !important; }

/* Vault */
.topbar {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
  position: sticky; top: 0; z-index: 5;
}
.topbar-actions { display: flex; gap: .5rem; flex: 1; }
.topbar-actions #search { flex: 1; }

.list { list-style: none; margin: 0; padding: 1rem; display: grid; gap: .5rem; }
.account-item {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  display: flex; align-items: center; gap: .75rem;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.account-item:hover {
  border-color: var(--accent);
  background: #1a2232;
}
.item-main {
  display: flex; align-items: center; gap: .75rem;
  flex: 1;
}
.site-icon {
  width: 32px; height: 32px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: bold;
  font-size: .9rem;
}
.item-info {
  display: flex; flex-direction: column;
}
.item-info .name { font-weight: 600; }
.item-info .user { color: var(--muted); font-size: .85rem; }
.item-actions {
  display: flex; gap: .35rem;
}
.item-actions .danger:hover {
  background: var(--danger);
  color: #fff;
}

.empty-state {
  text-align: center; padding: 3rem 1rem;
  color: var(--muted); font-style: italic;
}

.list .name { font-weight: 600; }
.list .user { color: var(--muted); font-size: .85rem; }
.list .actions { margin-left: auto; display: flex; gap: .35rem; }

.panel {
  margin: 1rem; padding: 1rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-soft);
}
.panel h2 { margin: 0 0 .75rem; font-size: 1rem; }
.gen-output {
  display: flex; gap: .5rem; align-items: center; margin-bottom: .75rem;
}
.gen-output code {
  flex: 1; background: #0e1420; padding: .6rem .8rem; border-radius: 8px;
  overflow-x: auto; white-space: nowrap;
}
.checks { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin: .75rem 0; }
.checks label { margin: 0; color: var(--text); font-size: .9rem; }

dialog {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-soft); color: var(--text);
  padding: 1.5rem; width: min(480px, 92vw);
}
dialog::backdrop { background: rgba(0,0,0,.6); }
.dialog-actions {
  display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem;
}

.toast {
  position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%);
  background: #16202f; border: 1px solid var(--border);
  padding: .6rem 1rem; border-radius: 999px; box-shadow: var(--shadow);
  z-index: 100;
  transition: opacity .2s;
}
.toast.info { border-left: 4px solid var(--accent); }
.toast.success { border-left: 4px solid var(--accent-2); }
.toast.error { border-left: 4px solid var(--danger); }

button[aria-busy="true"] {
  opacity: .6;
  cursor: wait;
}

[hidden] { display: none !important; }

/* Audit Report */
.audit-summary {
  display: grid; gap: .5rem; margin-bottom: 1.5rem;
}
.stat-row {
  display: flex; justify-content: space-between;
  padding: .5rem; background: #0e1420; border-radius: 6px;
}
.stat-row.weak { color: var(--danger); }
.stat-row.repeated { color: #f59e0b; }
.stat-row.no2fa { color: #fbbf24; }
.stat-row.outdated { color: var(--muted); }

.audit-details-list {
  list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem;
}
.audit-details-list li {
  padding: .5rem; border-bottom: 1px solid var(--border);
  font-size: .85rem;
}
.audit-ok {
  text-align: center; color: var(--accent-2);
  font-weight: 600; padding: 1rem;
}
.dialog-content {
  display: flex; flex-direction: column; gap: 1rem;
}

.totp-display {
  display: flex; align-items: center; gap: 0.5rem;
  min-width: 120px; justify-content: flex-end;
}

.sync-actions-main {
  display: flex; justify-content: center; gap: 1rem;
}

.sync-actions-close {
  display: flex; justify-content: center;
}

.sync-status-text {
  text-align: center; margin: 1rem 0;
}

.maint-backup-row {
  display: flex; justify-content: space-between; margin: 1.5rem 0;
}

.maint-backup-col {
  display: flex; flex-direction: column; gap: 0.5rem;
}

.maint-backup-col.right {
  text-align: right;
}
