/* Заметки — оформление приложения */

:root {
  --bg: #f6f6f2;
  --panel: #ffffff;
  --panel-2: #fbfbf8;
  --panel-3: #f1f1ec;
  --text: #1d211d;
  --muted: #6f756e;
  --faint: #9aa097;
  --border: #e4e4dc;
  --border-strong: #d3d4ca;
  --accent: #1f8a4c;
  --accent-hover: #187a42;
  --accent-soft: #e6f3ec;
  --danger: #c0392b;
  --danger-soft: #fbecea;
  --shadow: 0 1px 2px rgba(20, 30, 20, .06), 0 8px 24px -12px rgba(20, 30, 20, .18);
  --radius: 10px;
  --radius-sm: 7px;
  --sidebar-w: 250px;
  --list-w: 340px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-read: "Georgia", "Times New Roman", serif;
  --font-mono: "Cascadia Code", "SF Mono", Consolas, monospace;
}

html[data-theme="dark"] {
  --bg: #121412;
  --panel: #1a1d1a;
  --panel-2: #161916;
  --panel-3: #232723;
  --text: #e7eae4;
  --muted: #9aa197;
  --faint: #767d73;
  --border: #2a2f2a;
  --border-strong: #3a403a;
  --accent: #3fb96f;
  --accent-hover: #4fca7e;
  --accent-soft: #1c2f23;
  --danger: #e3705f;
  --danger-soft: #33201d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -14px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }

/* ------------------------------------------------------------------ кнопки */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: background .12s, border-color .12s, transform .06s;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--panel-3); }
.btn-icon { width: 34px; padding: 0; }
.btn svg { width: 16px; height: 16px; flex: none; }

.icon { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- каркас */

#app {
  display: grid;
  grid-template-columns: var(--sidebar-w) var(--list-w) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

#sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--panel-2);
  border-right: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 16px 10px;
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -.01em;
}
.brand .logo {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: linear-gradient(150deg, var(--accent), #2fa862);
  display: grid; place-items: center;
  color: #fff;
  box-shadow: 0 2px 6px rgba(31, 138, 76, .28);
}
.brand .logo svg { width: 15px; height: 15px; stroke-width: 2.1; }

.new-note-btn {
  margin: 4px 12px 10px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--accent);
  color: #fff;
  border: 0;
  font-weight: 600;
  font-size: 13.5px;
  box-shadow: 0 2px 8px -2px rgba(31, 138, 76, .5);
}
.new-note-btn:hover { background: var(--accent-hover); }
.new-note-btn kbd {
  margin-left: auto; margin-right: 10px;
  font: 11px var(--font-mono);
  opacity: .7;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 4px; padding: 1px 4px;
}

.side-scroll { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 10px; }
.side-scroll::-webkit-scrollbar { width: 9px; }
.side-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid var(--panel-2); }

.side-nav { padding: 0 8px; display: flex; flex-direction: column; gap: 1px; }
.side-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 7px 9px;
  border: 0; background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13.5px;
  text-align: left;
}
.side-item:hover { background: var(--panel-3); }
.side-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
html[data-theme="dark"] .side-item.active { color: var(--accent); }
.side-item .icon { color: var(--muted); }
.side-item.active .icon { color: var(--accent); }
.side-item .count {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 5px;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--faint);
}
.side-head button {
  border: 0; background: transparent; color: var(--faint);
  width: 22px; height: 22px; border-radius: 5px;
  display: grid; place-items: center;
}
.side-head button:hover { background: var(--panel-3); color: var(--text); }

.nb-list { padding: 0 8px; display: flex; flex-direction: column; gap: 1px; }
.nb-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 9px;
  border: 0; background: transparent;
  border-radius: var(--radius-sm);
  width: 100%;
  font-size: 13.5px;
  color: var(--text);
  text-align: left;
}
.nb-item:hover { background: var(--panel-3); }
.nb-item.active { background: var(--accent-soft); font-weight: 600; }
.nb-item .dot { width: 8px; height: 8px; border-radius: 3px; background: var(--accent); flex: none; opacity: .8; }
.nb-item .nb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-item .count { margin-left: auto; font-size: 11.5px; color: var(--faint); }
.nb-item .nb-more {
  width: 18px; height: 18px; border-radius: 4px;
  display: grid; place-items: center;
  color: var(--faint);
  opacity: 0;
  transition: opacity .12s;
  margin-left: 2px;
}
.nb-item:hover .nb-more, .nb-item.active .nb-more { opacity: 1; }
.nb-item .nb-more:hover { background: var(--border); color: var(--text); }
.nb-item .nb-more svg { width: 13px; height: 13px; }
.nb-item .nb-toggle { width: 14px; color: var(--faint); display: grid; place-items: center; }
.nb-item .nb-toggle svg { width: 11px; height: 11px; transition: transform .15s; }
.nb-item.collapsed .nb-toggle svg { transform: rotate(-90deg); }
.nb-item .nb-toggle.empty { visibility: hidden; }

.tag-cloud { padding: 2px 14px 6px; display: flex; flex-wrap: wrap; gap: 5px; }
.tag-chip {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 999px;
  padding: 2.5px 9px;
  font-size: 12px;
  color: var(--muted);
}
.tag-chip:hover { border-color: var(--accent); color: var(--accent); }
.tag-chip.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); color: var(--accent); font-weight: 600; }
.tag-chip .n { opacity: .6; margin-left: 4px; font-size: 11px; }

.side-footer {
  border-top: 1px solid var(--border);
  padding: 8px;
}
.user-btn {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 6px 8px;
  border: 0; background: transparent; border-radius: var(--radius-sm);
  text-align: left;
}
.user-btn:hover { background: var(--panel-3); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; flex: none;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-meta { min-width: 0; flex: 1; }
.user-name { font-size: 13px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-mail { font-size: 11.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-btn .gear {
  width: 24px; height: 24px; flex: none;
  display: grid; place-items: center;
  color: var(--faint);
  border-radius: 5px;
}
.user-btn .gear svg { width: 15px; height: 15px; }
.user-btn:hover .gear { color: var(--text); background: var(--border); }

/* ------------------------------------------------------------- список заметок */

#list-pane {
  display: flex; flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
}

.list-head { padding: 13px 14px 9px; border-bottom: 1px solid var(--border); }
.list-title-row { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.list-title-row h1 { font-size: 16px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
.list-title-row .muted { color: var(--faint); font-size: 12px; margin-left: 2px; }
.list-title-row .spacer { flex: 1; }

#menu-toggle { display: none; }

.search-box { position: relative; }
.search-box svg {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--faint); pointer-events: none;
}
.search-box input {
  width: 100%;
  height: 33px;
  padding: 0 30px 0 31px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  font-size: 13px;
  outline: none;
}
.search-box input:focus { border-color: var(--accent); background: var(--panel); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box .clear {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--faint);
  width: 22px; height: 22px; border-radius: 4px;
  display: none; place-items: center;
}
.search-box.has-value .clear { display: grid; }
.search-box .clear:hover { background: var(--panel-3); color: var(--text); }

.list-tools { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.list-tools .btn { height: 27px; padding: 0 9px; font-size: 12px; border-radius: 6px; }
.list-tools .btn svg { width: 14px; height: 14px; }

.note-list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px; }
.note-list::-webkit-scrollbar { width: 9px; }
.note-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid var(--panel); }

.note-card {
  position: relative;
  display: block; width: 100%;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 9px;
  padding: 10px 11px;
  text-align: left;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.note-card:hover { background: var(--panel-2); }
.note-card.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.note-card.active .note-title { color: var(--accent); }
.note-card-top { display: flex; align-items: baseline; gap: 6px; }
.note-title {
  font-size: 13.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1; min-width: 0;
}
.note-card .pin { color: var(--accent); flex: none; }
.note-card .pin svg { width: 12px; height: 12px; }
.note-date { font-size: 11px; color: var(--faint); flex: none; margin-left: auto; }
.note-preview {
  margin-top: 3px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.note-preview mark, .note-preview .hl { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }
.note-card-meta { display: flex; align-items: center; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.note-card-meta .mini-tag {
  font-size: 10.5px; color: var(--muted);
  background: var(--panel-3);
  border-radius: 4px; padding: 1px 5px;
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.note-card-meta .nb-name-mini { font-size: 10.5px; color: var(--faint); display: inline-flex; align-items: center; gap: 3px; }
.nb-dot { width: 6px; height: 6px; border-radius: 2px; background: var(--accent); display: inline-block; }
.note-card .card-actions {
  margin-left: auto;
  display: flex;
  gap: 2px;
  flex: none;
}
.note-card .card-action {
  width: 24px; height: 24px;
  border: 0; border-radius: 5px;
  background: transparent; color: var(--faint);
  display: grid; place-items: center;
  opacity: .55;
  transition: opacity .12s, background .12s, color .12s;
  padding: 0;
}
.note-card .card-action svg { width: 14px; height: 14px; }
.note-card:hover .card-action, .note-card.active .card-action, .note-card .card-action:focus-visible { opacity: 1; }
.note-card .card-action:hover { background: var(--panel-3); color: var(--text); }
.note-card .card-action.danger:hover { background: var(--danger-soft); color: var(--danger); }
.note-card .card-action:active { transform: scale(.92); }

.empty-list { padding: 40px 22px; text-align: center; color: var(--faint); font-size: 13px; line-height: 1.6; }
.empty-list svg { width: 34px; height: 34px; opacity: .5; margin-bottom: 8px; }

/* ------------------------------------------------------------------ редактор */

#editor-pane { min-width: 0; min-height: 0; background: var(--panel); display: flex; flex-direction: column; overflow: hidden; }

.editor-empty {
  flex: 1; display: grid; place-items: center;
  color: var(--faint); text-align: center; padding: 24px;
}
.editor-empty .art { font-size: 15px; color: var(--muted); margin-bottom: 6px; }
.editor-empty .hint { font-size: 12.5px; line-height: 1.7; }
.editor-empty kbd {
  font: 11px var(--font-mono); border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 5px; background: var(--panel-2);
}

.editor { display: flex; flex-direction: column; height: 100%; min-height: 0; }

.editor-top {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 14px 4px;
}
.editor-top .back { display: none; }
.editor-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.editor-actions .btn { height: 30px; }
.editor-actions .btn-icon { width: 30px; color: var(--muted); }
.editor-actions .btn-icon:hover { color: var(--text); }
.editor-actions .btn-icon.on { color: var(--accent); background: var(--accent-soft); }

.note-title-input {
  flex: 1; min-width: 0;
  border: 0; outline: none; background: transparent;
  font-size: 23px; font-weight: 700; letter-spacing: -.015em;
  padding: 4px 0;
}
.note-title-input::placeholder { color: var(--faint); opacity: .7; font-weight: 600; }

.editor-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 0 16px 10px;
  font-size: 12px; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.editor-meta .divider { color: var(--border-strong); }
.nb-select {
  border: 1px solid transparent; background: transparent;
  border-radius: 5px; padding: 2px 4px 2px 6px;
  font-size: 12px; color: var(--muted); max-width: 190px;
  cursor: pointer;
}
.nb-select:hover { border-color: var(--border); }
.nb-select:focus { outline: none; border-color: var(--accent); }

.tags-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; flex: 1; min-width: 120px; }
.tag-pill {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--panel-3);
  border-radius: 999px;
  padding: 1.5px 4px 1.5px 8px;
  font-size: 11.5px;
  color: var(--text);
}
.tag-pill button { border: 0; background: transparent; color: var(--faint); width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; padding: 0; }
.tag-pill button:hover { background: var(--border); color: var(--danger); }
.tag-input {
  border: 0; background: transparent; outline: none;
  font-size: 12px; min-width: 70px; width: 90px;
  color: var(--text);
  padding: 2px 2px;
}
.tag-input::placeholder { color: var(--faint); }
.saved-indicator { display: inline-flex; align-items: center; gap: 4px; color: var(--faint); font-size: 11.5px; white-space: nowrap; }
.saved-indicator .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.saved-indicator.saving .dot { background: var(--faint); animation: pulse 1s infinite; }
.saved-indicator.error { color: var(--danger); }
.saved-indicator.error .dot { background: var(--danger); }
@keyframes pulse { 50% { opacity: .3; } }

.toolbar {
  display: flex; align-items: center; gap: 1px; flex-wrap: wrap;
  padding: 5px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.toolbar .tb {
  width: 29px; height: 27px; border-radius: 5px;
  border: 0; background: transparent; color: var(--muted);
  display: grid; place-items: center;
  font-size: 13px;
}
.toolbar .tb:hover { background: var(--panel-3); color: var(--text); }
.toolbar .tb.on { background: var(--accent-soft); color: var(--accent); }
.toolbar .tb svg { width: 15px; height: 15px; }
.toolbar .sep { width: 1px; height: 17px; background: var(--border); margin: 0 4px; }
.toolbar .tb.wide { width: auto; padding: 0 8px; font-size: 12px; font-weight: 600; }

.editor-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.editor-scroll::-webkit-scrollbar { width: 10px; }
.editor-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 3px solid var(--panel); }

.editor-body {
  min-height: 300px;
  max-width: 820px;
  margin: 0 auto;
  padding: 16px 18px 40px;
  outline: none;
  font-size: 15px;
  line-height: 1.62;
  word-break: break-word;
  caret-color: var(--accent);
}
.editor-body:empty::before {
  content: attr(data-placeholder);
  color: var(--faint);
  opacity: .75;
}
.editor-body h1 { font-size: 26px; margin: .7em 0 .3em; line-height: 1.25; }
.editor-body h2 { font-size: 21px; margin: .8em 0 .3em; line-height: 1.3; }
.editor-body h3 { font-size: 17.5px; margin: .9em 0 .25em; }
.editor-body p, .editor-body div { margin: 0 0 .55em; }
.editor-body ul, .editor-body ol { padding-left: 1.5em; margin: .35em 0 .7em; }
.editor-body li { margin: .15em 0; }
.editor-body blockquote {
  margin: .6em 0; padding: 2px 0 2px 14px;
  border-left: 3px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--muted);
}
.editor-body pre {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; overflow-x: auto;
  font: 13px/1.5 var(--font-mono);
  white-space: pre-wrap;
}
.editor-body code { font: 13px/1.5 var(--font-mono); background: var(--panel-3); border-radius: 4px; padding: 1px 4px; }
.editor-body pre code { background: transparent; padding: 0; }
.editor-body a { color: var(--accent); text-underline-offset: 2px; }
.editor-body img { max-width: 100%; border-radius: 8px; margin: 6px 0; display: block; }
.editor-body hr { border: 0; border-top: 1px solid var(--border-strong); margin: 1.2em 0; }
.editor-body table { border-collapse: collapse; margin: .6em 0; width: 100%; }
.editor-body td, .editor-body th { border: 1px solid var(--border-strong); padding: 5px 8px; vertical-align: top; }
.editor-body th { background: var(--panel-2); font-weight: 600; }
.editor-body .todo { font-size: 15px; margin-right: 2px; cursor: pointer; user-select: none; }

.attachments {
  padding: 0 16px 12px;
  display: flex; flex-wrap: wrap; gap: 6px;
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
}
.attachment {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 12px;
  max-width: 260px;
}
.attachment .icon { color: var(--accent); flex: none; }
.attachment .size { color: var(--faint); font-size: 11px; }
.attachment .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment .del { border: 0; background: transparent; color: var(--faint); padding: 0; width: 16px; height: 16px; display: grid; place-items: center; border-radius: 4px; }
.attachment .del:hover { color: var(--danger); background: var(--danger-soft); }

/* ---------------------------------------------------------------- модальные */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 20, 15, .42);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  z-index: 50;
  padding: 18px;
  animation: fade .12s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(520px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  background: var(--panel);
  border-radius: 14px;
  box-shadow: 0 24px 60px -12px rgba(0,0,0,.4);
  border: 1px solid var(--border);
  padding: 18px 20px 20px;
  animation: pop .14s ease-out;
}
@keyframes pop { from { transform: translateY(6px) scale(.99); opacity: 0; } }
.modal h2 { margin: 0 0 3px; font-size: 17px; }
.modal .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 14px; }
.modal-close {
  position: absolute; top: 0; right: 0;
  border: 0; background: transparent; color: var(--faint);
  width: 32px; height: 32px; border-radius: 6px;
  display: grid; place-items: center;
}
.modal-head { position: relative; padding-right: 30px; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.field input, .field textarea, .field select {
  width: 100%; height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  padding: 0 10px;
  outline: none;
  font-size: 13.5px;
}
.field textarea { height: auto; min-height: 160px; padding: 8px 10px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--panel); }
.field .hint { font-size: 11.5px; color: var(--faint); margin-top: 4px; line-height: 1.5; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 42px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%;
  transform: translateY(-50%);
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 0; border-radius: 6px;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
}
.pw-toggle:hover { color: var(--text); background: var(--panel-3); }
.pw-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pw-toggle svg { width: 17px; height: 17px; }
.field .btn { height: 34px; flex: 1 1 0; }
.field .btn-row { display: flex; gap: 8px; align-items: stretch; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

.drop-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: 10px;
  padding: 26px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop-zone:hover, .drop-zone.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-zone .big { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 3px; }

/* ------------------------------------------------------------------ тосты */

#toast {
  position: fixed; left: 50%; bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  background: #23291f;
  color: #f2f5ee;
  border-radius: 9px;
  padding: 9px 15px;
  font-size: 13px;
  box-shadow: 0 12px 30px -8px rgba(0,0,0,.45);
  opacity: 0; pointer-events: none;
  transition: opacity .18s, transform .18s;
  z-index: 90;
  max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: #4a1f19; }
#toast.success { background: #16351f; }

/* ---------------------------------------------------------------- адаптив */

@media (max-width: 1100px) {
  :root { --list-w: 300px; --sidebar-w: 220px; }
}

@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 1fr; position: relative; }
  #sidebar {
    position: fixed; inset: 0 25% 0 0;
    z-index: 40;
    transform: translateX(-102%);
    transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.25);
    max-width: 320px;
  }
  body.drawer-open #sidebar { transform: translateX(0); }
  body.drawer-open::after {
    content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 39;
  }
  #list-pane { grid-column: 1; grid-row: 1; border-right: 0; }
  #editor-pane { display: none; grid-column: 1; grid-row: 1; }
  body.editor-open #list-pane { display: none; }
  body.editor-open #editor-pane { display: flex; }
  #menu-toggle { display: grid; }
  .editor-top .back { display: grid; }
  .editor-top { padding-top: 10px; }
  .note-title-input { font-size: 20px; }
  .list-tools .btn span { display: none; }
  .list-tools .btn { padding: 0 8px; }
  #files-head .list-tools .btn span { display: inline; }
  #files-head .list-tools .btn { padding: 0 12px; gap: 7px; }
  .note-list { padding-bottom: 96px; }
}

@media (max-width: 560px) {
  .editor-body { padding: 14px 14px 60px; font-size: 15px; }
  .toolbar { padding: 4px 6px; overflow-x: auto; flex-wrap: nowrap; }
  .toolbar::-webkit-scrollbar { display: none; }
  .modal { padding: 16px; border-radius: 12px; }
}

/* ---------------------------------------------------------------- логин */

.auth-page {
  min-height: 100%;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  overflow-y: auto;
}
.auth-art {
  position: relative;
  background: linear-gradient(150deg, #12351f 0%, #1f6b3f 55%, #2f9a5d 100%);
  color: #eef7ef;
  padding: 44px 46px;
  display: flex; flex-direction: column; justify-content: space-between;
  overflow: hidden;
}
.auth-art::before {
  content: '';
  position: absolute; width: 520px; height: 520px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.14);
  right: -180px; top: -140px;
}
.auth-art::after {
  content: '';
  position: absolute; width: 340px; height: 340px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.1);
  right: 40px; bottom: -160px;
}
.auth-art .brand { padding: 0; font-size: 16px; }
.auth-art .brand .logo { background: rgba(255,255,255,.14); box-shadow: none; }
.auth-copy { position: relative; z-index: 1; }
.auth-copy h2 { font-size: clamp(26px, 3.4vw, 40px); line-height: 1.14; letter-spacing: -.025em; margin: 0 0 14px; font-weight: 700; }
.auth-copy p { font-size: 14.5px; line-height: 1.6; color: rgba(238,247,239,.76); max-width: 40ch; margin: 0; }
.auth-features { display: flex; flex-direction: column; gap: 9px; margin-top: 26px; font-size: 13px; color: rgba(238,247,239,.85); }
.auth-features span { display: flex; align-items: center; gap: 8px; }
.auth-features svg { width: 15px; height: 15px; opacity: .8; }
.auth-foot { font-size: 11.5px; color: rgba(238,247,239,.5); position: relative; z-index: 1; }

.auth-panel { display: grid; place-items: center; padding: 34px 22px; background: var(--bg); }
.auth-card { width: min(400px, 100%); }
.auth-mobile-brand {
  display: none;
  align-items: center;
  gap: 9px;
  font-weight: 650;
  font-size: 15px;
  margin-bottom: 20px;
}
.auth-mobile-brand .logo {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(150deg, var(--accent), #2fa862);
  display: grid; place-items: center; color: #fff;
}
.auth-mobile-brand .logo svg { width: 15px; height: 15px; stroke-width: 2.1; }
.auth-card h1 { font-size: 24px; letter-spacing: -.02em; margin: 0 0 4px; }
.auth-card .lead { color: var(--muted); font-size: 13.5px; margin: 0 0 20px; }
.auth-tabs {
  display: flex; gap: 2px; background: var(--panel-3);
  border: 1px solid var(--border);
  border-radius: 9px; padding: 3px; margin-bottom: 18px;
}
.auth-tabs button {
  flex: 1; height: 31px; border: 0; border-radius: 6px;
  background: transparent; color: var(--muted); font-size: 13px; font-weight: 550;
}
.auth-tabs button.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.google-btn {
  width: 100%; height: 42px;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  border-radius: 9px;
  font-size: 13.5px; font-weight: 550;
  color: var(--text);
  text-decoration: none;
}
.google-btn:hover { background: var(--panel-3); }
.google-btn svg { width: 17px; height: 17px; }

.auth-divider { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 11px; margin: 16px 0; text-transform: uppercase; letter-spacing: .06em; }
.auth-divider::before, .auth-divider::after { content: ''; height: 1px; background: var(--border); flex: 1; }

.auth-form .field input { height: 41px; font-size: 14px; }
.auth-form .btn-primary { width: 100%; height: 41px; font-size: 14px; margin-top: 4px; }
.auth-error {
  display: none;
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 12.5px;
  line-height: 1.5;
  margin-bottom: 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
}
.auth-error.show { display: block; }
.auth-note { font-size: 11.5px; color: var(--faint); line-height: 1.55; margin-top: 14px; }
.auth-note a { color: var(--accent); }

@media (max-width: 780px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-panel { min-height: 100%; padding: 52px 20px 36px; place-items: start center; }
  .auth-mobile-brand { display: flex; }
}

/* ------------------------------------------------------------------ файлы */

.file-card {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 11px;
  border-bottom: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
}
.file-card:hover { background: var(--panel-2); }
.file-card.active { background: var(--accent-soft); }
.file-icon {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--panel-3);
  color: var(--accent);
}
.file-icon svg { width: 17px; height: 17px; }
.file-main { min-width: 0; flex: 1; }
.file-name {
  font-size: 13.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-desc {
  font-size: 12px; color: var(--muted); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; font-size: 11px; color: var(--faint); }
.file-card .card-share { opacity: 0; }

.file-detail { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.file-detail-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.file-detail-head .file-name-input {
  flex: 1; min-width: 0;
  border: 1px solid transparent; background: transparent; outline: none;
  font-size: 19px; font-weight: 700; letter-spacing: -.01em;
  padding: 4px 6px; border-radius: 6px;
}
.file-detail-head .file-name-input:hover { border-color: var(--border); }
.file-detail-head .file-name-input:focus { border-color: var(--accent); background: var(--panel-2); }
.file-preview {
  flex: 1; min-height: 0;
  display: grid; place-items: center;
  padding: 18px;
  background: var(--panel-2);
  overflow: auto;
}
.file-preview img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: var(--shadow); }
.file-preview iframe { width: 100%; height: 100%; border: 0; border-radius: 10px; background: #fff; }
.file-preview .placeholder { text-align: center; color: var(--faint); font-size: 13px; line-height: 1.7; }
.file-preview .placeholder svg { width: 46px; height: 46px; opacity: .45; margin-bottom: 10px; }
.file-info { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.file-info b { color: var(--text); font-weight: 600; }
.file-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 14px; }
.file-actions .btn { height: 30px; font-size: 12.5px; }

.drop-target.drag-over { outline: 2px dashed var(--accent); outline-offset: -6px; background: var(--accent-soft); border-radius: 8px; }

@media (max-width: 700px) {
  .file-info { gap: 6px 16px; }
  .file-preview { padding: 10px; }
}

/* ------------------------------------------------------- кнопка «+» на телефоне */

.fab {
  position: fixed;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  width: 56px; height: 56px;
  border: 0; border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: none;
  place-items: center;
  box-shadow: 0 8px 22px -6px rgba(0, 0, 0, .45);
  z-index: 45;
  transition: transform .12s, background .12s;
}
.fab svg { width: 26px; height: 26px; stroke-width: 2.4; }
.fab:active { transform: scale(.94); }

.fab-menu {
  position: fixed;
  right: 18px;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  z-index: 46;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}
.fab-menu button {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-weight: 550;
  box-shadow: var(--shadow);
  white-space: nowrap;
}
.fab-menu button svg { width: 18px; height: 18px; color: var(--accent); }
.fab-menu button:active { background: var(--panel-3); }

@media (max-width: 860px) {
  .fab { display: grid; }
  body.editor-open .fab,
  body.editor-open .fab-menu,
  body.modal-open .fab,
  body.modal-open .fab-menu,
  body.drawer-open .fab,
  body.drawer-open .fab-menu { display: none !important; }
}

/* --------------------------------------------------------- вспомогательные */

.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
