:root {
  color-scheme: light dark;
  --bg: #e3f7ef;
  --card: #ffffff;
  --ink: #0b2e24;
  --muted: #4f6b62;
  --line: #c4e3d7;
  --accent: #167a5e;
  --accent-ink: #ffffff;
  --soft: #cdeee1;
  --danger: #b3261e;
  --warn-bg: #fff4d6;
  --warn-ink: #4a3500;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1f1a;
    --card: #15302a;
    --ink: #e3f7ef;
    --muted: #9dbdb2;
    --line: #26493f;
    --accent: #5fd3ad;
    --accent-ink: #062a1f;
    --soft: #1e3f36;
    --danger: #ff8a80;
    --warn-bg: #3a3014;
    --warn-ink: #ffe8a6;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 500 17px/1.45 Gabarito, ui-rounded, system-ui, sans-serif;
}
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

h1, h2 { margin: 0 0 6px; line-height: 1.1; letter-spacing: -0.015em; }
h1 { font-size: 2.2rem; font-weight: 800; }
h2 { font-size: 1.5rem; font-weight: 700; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.lede { color: var(--muted); margin-bottom: 20px; }

.screen { min-height: 100dvh; padding: 20px clamp(12px, 4vw, 40px) 40px; }
.center { display: grid; place-items: center; }
.card { background: var(--card); border-radius: calc(var(--radius) * 1.5); padding: clamp(20px, 5vw, 36px); box-shadow: 0 1px 0 var(--line); }
.narrow { width: min(440px, 100%); }
.lock-badge { font-size: 2.4rem; margin-bottom: 4px; }

label { display: block; margin: 0 0 14px; font-weight: 700; font-size: 0.95rem; }
label.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
label.check { font-weight: 500; }
input, textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 11px 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
}
input:focus, textarea:focus { border-color: var(--accent); outline: none; }
input[type="checkbox"] { display: inline-block; width: auto; margin: 0; accent-color: var(--accent); }
input[type="range"] { display: inline-block; width: 140px; margin: 0; padding: 0; border: 0; background: none; accent-color: var(--accent); }
textarea { resize: vertical; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 76px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.pw-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); margin-top: 2px; }

button {
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: var(--radius);
  padding: 10px 16px;
  cursor: pointer;
  color: var(--ink);
  background: var(--soft);
}
button:disabled { opacity: 0.6; cursor: progress; }
.primary { background: var(--accent); color: var(--accent-ink); }
.ghost { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.ghost:hover { background: var(--soft); }
.small { padding: 5px 10px; font-size: 0.85rem; }
.wide { width: 100%; padding: 13px; margin-top: 4px; }
.danger { background: var(--danger); color: #fff; }
.danger-text { color: var(--danger); }
.link { background: none; padding: 8px 0 0; color: var(--muted); text-decoration: underline; }

.switch { display: flex; gap: 4px; padding: 4px; margin-bottom: 18px; background: var(--soft); border-radius: var(--radius); }
.switch button { flex: 1; background: transparent; padding: 8px; }
.switch button[aria-selected="true"] { background: var(--card); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }

.warn { background: var(--warn-bg); color: var(--warn-ink); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; font-size: 0.95rem; }
.warn strong { display: block; margin-bottom: 2px; }
.error { color: var(--danger); font-weight: 700; min-height: 1.2em; margin: 0 0 8px; }
.error:empty { min-height: 0; margin: 0; }

/* vault */
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 900px; margin: 0 auto 6px; }
.brand { font-size: 1.8rem; margin: 0 8px 0 0; }
#search { flex: 1 1 180px; margin: 0; min-width: 0; }
.count { max-width: 900px; margin: 6px auto 10px; font-size: 0.9rem; }

.list { list-style: none; margin: 0 auto; padding: 0; max-width: 900px; display: grid; gap: 8px; }
.entry {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--card);
  border-radius: var(--radius);
}
.avatar {
  width: 44px; height: 44px; border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 1.2rem; color: #fff;
}
.who { min-width: 0; cursor: pointer; }
.who .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .sub { color: var(--muted); font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .shown { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9rem; word-break: break-all; margin-top: 2px; }
.btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.btns button { padding: 7px 11px; font-size: 0.85rem; }
.empty { max-width: 900px; margin: 40px auto; text-align: center; }

dialog {
  width: min(520px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  border: 0;
  border-radius: calc(var(--radius) * 1.5);
  padding: 24px;
  background: var(--card);
  color: var(--ink);
}
dialog::backdrop { background: rgb(5 25 19 / 0.55); }
.actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.spacer { flex: 1; }
.menu { display: grid; gap: 6px; margin: 14px 0; }
.menu button { text-align: left; background: var(--soft); }
.small-print { font-size: 0.85rem; }
details { margin: -4px 0 14px; }
summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.gen-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 10px; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; font-weight: 700;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.25);
  z-index: 10;
}

@media (max-width: 600px) {
  .entry { grid-template-columns: 40px 1fr; }
  .avatar { width: 40px; height: 40px; }
  .btns { grid-column: 1 / -1; justify-content: flex-start; gap: 5px; }
  .btns button { padding: 6px 7px; font-size: 0.8rem; }
  .entry { padding: 10px; }
  .brand { flex: 1; }
  #search { order: 10; flex-basis: 100%; }
}
