:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1c1f24;
  --muted: #6b7280;
  --line: #e3e5e9;
  --accent: #2f5bea;
  --accent-text: #ffffff;
  --danger: #c62828;
  --hover: #f0f2f6;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171b;
    --panel: #1e2126;
    --text: #e8eaed;
    --muted: #9aa0a8;
    --line: #2e3238;
    --accent: #5b82ff;
    --danger: #ef6b6b;
    --hover: #262a30;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button, input, textarea, select { font: inherit; color: inherit; }
input, textarea, select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel);
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { min-height: 80px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
button {
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); cursor: pointer; white-space: nowrap;
}
button:hover { background: var(--hover); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--danger); }
button.small { padding: 4px 10px; font-size: 13px; }
button.link { border: none; background: none; padding: 0; color: var(--accent); }
.muted { color: var(--muted); }
.error { color: var(--danger); margin-top: 10px; min-height: 1.4em; }

/* вход */
.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; width: 100%; max-width: 380px; }
.card h1 { margin: 0 0 4px; font-size: 22px; }
.card button.primary { width: 100%; margin-top: 18px; padding: 10px; }

/* основной экран */
header {
  display: flex; gap: 10px; align-items: center; padding: 12px 16px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
header .logo { font-weight: 700; font-size: 17px; margin-right: 8px; }
header input { max-width: 420px; }
header .spacer { flex: 1; }
.layout { display: flex; max-width: 1200px; margin: 0 auto; }
nav { width: 210px; padding: 16px 8px; flex-shrink: 0; }
nav button {
  display: flex; justify-content: space-between; width: 100%; border: none; background: none;
  text-align: left; padding: 7px 10px; border-radius: 8px;
}
nav button.active { background: var(--hover); font-weight: 600; }
nav .sep { height: 1px; background: var(--line); margin: 10px 6px; }
nav .count { color: var(--muted); font-size: 13px; }
main { flex: 1; padding: 16px; min-width: 0; }
main h2 { margin: 0 0 12px; font-size: 18px; }

.list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line); }
.row:first-child { border-top: none; }
.row.click { cursor: pointer; }
.row.click:hover { background: var(--hover); }
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .actions { display: flex; gap: 6px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--hover); color: var(--muted); }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }

/* окно */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: grid; place-items: center; padding: 16px; z-index: 10; }
.modal { background: var(--panel); border-radius: var(--radius); padding: 22px; width: 100%; max-width: 480px; max-height: 92vh; overflow: auto; }
.modal h3 { margin: 0 0 6px; font-size: 18px; }
.modal .buttons { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.modal .buttons .spacer { flex: 1; }
.pw { display: flex; gap: 6px; }
.pw input { font-family: ui-monospace, Consolas, monospace; }
.meta { font-size: 12px; color: var(--muted); margin-top: 14px; }
.checkbox { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--text); font-size: 15px; }
.checkbox input { width: auto; }

.mt6 { margin-top: 6px; }
.mt18 { margin-top: 18px; }
.dim { opacity: .5; }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.toolbar h2 { margin: 0; flex: 1; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 8px; z-index: 20;
}

@media (max-width: 720px) {
  header { flex-wrap: wrap; }
  header input { order: 3; max-width: none; }
  .layout { flex-direction: column; }
  nav { width: auto; display: flex; overflow-x: auto; padding: 8px 16px 0; gap: 4px; }
  nav button { width: auto; gap: 6px; }
  nav .sep { display: none; }
  .row .actions .hide-mobile { display: none; }
}
