:root {
  --bg: #0c0f14;
  --panel: #151a22;
  --panel-2: #1c232e;
  --line: #2a3340;
  --text: #e6ebf2;
  --muted: #8b97a8;
  --accent: #4f9cf9;
  --accent-ink: #06121f;
  --ok: #3ecf8e;
  --warn: #f5b942;
  --bad: #f06565;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-height: 100vh; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
p { margin: 0 0 1rem; }
.muted { color: var(--muted); }
.noscript { padding: 2rem; }

button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: .6rem .75rem; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[type=checkbox] { width: auto; }
input[type=range] { padding: 0; }
textarea { resize: vertical; min-height: 5rem; }
label { display: block; margin-bottom: .9rem; }
label > span { display: block; color: var(--muted); font-size: .85rem; margin-bottom: .3rem; }
label.inline { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; }
label.inline > span { display: inline; margin: 0; }

.btn {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: .55rem .9rem; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.small { padding: .3rem .6rem; font-size: .85rem; }
.row { display: flex; gap: .5rem; align-items: center; }
.row > input { flex: 1; }
.spread { justify-content: space-between; }

/* centered auth card */
.center { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.card { width: 100%; max-width: 440px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1.75rem; }
.card h1 { font-size: 1.4rem; }
.notice { background: var(--panel-2); border-left: 3px solid var(--warn); padding: .7rem .9rem; border-radius: 6px; font-size: .88rem; margin-bottom: 1rem; }
.error { color: var(--bad); min-height: 1.3rem; margin: .25rem 0 .75rem; font-size: .9rem; }

/* strength meter */
.meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: -.4rem 0 .3rem; }
.meter i { height: 5px; border-radius: 3px; background: var(--line); }
.meter[data-level="1"] i:nth-child(-n+1) { background: var(--bad); }
.meter[data-level="2"] i:nth-child(-n+2) { background: var(--warn); }
.meter[data-level="3"] i:nth-child(-n+3) { background: var(--ok); }
.meter[data-level="4"] i:nth-child(-n+4) { background: var(--ok); }
.meter-label { font-size: .8rem; color: var(--muted); margin-bottom: .9rem; }

/* vault layout */
.top { display: flex; gap: .6rem; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 2; }
.top h2 { margin: 0 .5rem 0 0; font-size: 1.1rem; white-space: nowrap; }
.top input { max-width: 420px; }
.top .grow { flex: 1; }
.list { max-width: 820px; margin: 1rem auto; padding: 0 1rem; }
.item { display: flex; gap: .75rem; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; margin-bottom: .55rem; }
.item .info { flex: 1; min-width: 0; cursor: pointer; }
.item .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 3rem 1rem; }
.timer { color: var(--muted); font-size: .8rem; white-space: nowrap; }

/* dialogs */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 1.5rem; width: min(520px, 94vw); max-height: 92vh; overflow: auto; }
dialog::backdrop { background: rgba(0, 0, 0, .65); backdrop-filter: blur(4px); }
dialog h3 { font-size: 1.15rem; }
.actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }
.actions .left { margin-right: auto; }
details { background: var(--panel-2); border-radius: 8px; padding: .6rem .8rem; margin: -.3rem 0 .9rem; }
details summary { cursor: pointer; color: var(--muted); font-size: .88rem; }
details[open] summary { margin-bottom: .6rem; }
.gen-out { font-family: ui-monospace, Consolas, monospace; word-break: break-all; }
.settings-group { border-top: 1px solid var(--line); padding-top: .9rem; margin-top: .9rem; }

#toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%) translateY(150%); background: var(--text); color: var(--bg); padding: .55rem 1rem; border-radius: 8px; transition: transform .2s; pointer-events: none; z-index: 10; }
#toast.show { transform: translateX(-50%) translateY(0); }

@media (max-width: 560px) {
  .top { flex-wrap: wrap; }
  .top input { order: 5; max-width: none; flex-basis: 100%; }
  .item { flex-wrap: wrap; }
}
