:root {
  color-scheme: light dark;
  --fg: #1a1a1a;
  --bg: #fafafa;
  --muted: #666;
  --line: #ddd;
  --accent: #3a5fcd;
}
@media (prefers-color-scheme: dark) {
  :root { --fg: #e8e8e8; --bg: #16181c; --muted: #999; --line: #333; }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, sans-serif;
  color: var(--fg);
  background: var(--bg);
}
main {
  max-width: 48rem;
  margin: 0 auto;
  padding: 1rem;
}
button {
  font: inherit;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button.ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--line);
}
button.danger {
  background: #c0392b;
  border-color: #c0392b;
}
input, textarea {
  font: inherit;
  width: 100%;
  padding: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
}
label { display: block; margin-bottom: 0.7rem; }
.error { color: #c0392b; min-height: 1.2em; }
.spacer { flex: 1; }

header, .toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.8rem;
}
.password-row { display: flex; gap: 0.3rem; align-items: center; }
button.icon {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.6rem;
}
.totp-code {
  font-family: ui-monospace, monospace;
  color: var(--muted);
  white-space: nowrap;
  padding: 0 0.3rem;
}
/* The secret is write-once and rarely looked at — keep the field modest. */
#f-totp { flex: 0 1 14rem; width: auto; }

#list {
  list-style: none;
  margin: 0;
  padding: 0;
}
#list li {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--line);
}
.entry-info {
  flex: 1;
  min-width: 0; /* allow shrinking below content width so long URLs don't push the buttons out */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: transparent;
  border: none;
  color: var(--fg);
  text-align: left;
  padding: 0.3rem;
}
.entry-name {
  max-width: 100%;
  background: transparent;
  border: none;
  color: var(--fg);
  text-align: left;
  padding: 0;
}
.entry-info strong, .entry-info small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.entry-info small { color: var(--muted); }
.entry-site { max-width: 100%; text-decoration: none; }
.entry-site:hover small { color: var(--accent); text-decoration: underline; }
button.copy {
  background: transparent;
  color: var(--accent);
  border-color: var(--line);
  min-width: 3.5rem;
}
button.danger-text { color: #c0392b; }
dialog {
  max-width: 24rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg);
  padding: 1.2rem;
}
dialog::backdrop { background: rgb(0 0 0 / 0.5); }
dialog h2 { margin-top: 0; }
.code {
  font-family: ui-monospace, monospace;
  font-size: 1.3rem;
  letter-spacing: 0.05em;
  user-select: all;
  padding: 0.8rem;
  border: 1px dashed var(--line);
  border-radius: 6px;
  overflow-wrap: anywhere;
}
#cred-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
#cred-list li {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--line);
}
#cred-list { margin-bottom: 1rem; }
#guide-input { margin-bottom: 0.8rem; }
button.copy svg { vertical-align: -2px; margin-left: 2px; }
.scroll-list {
  list-style: none;
  margin: 0 0 0.8rem;
  padding: 0;
  max-height: 45vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.scroll-list li {
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--line);
}
.scroll-list li:last-child { border-bottom: none; }
.scroll-list small { color: var(--muted); }
