/* НОТА — темы и общие компоненты */

:root, [data-theme="green"] {
  --bg: linear-gradient(100deg, #040706 0%, #081310 32%, #10261d 68%, #1a3b2c 100%);
  --bg-solid: #0d1c15;
  --head: #030504;
  --rail: rgba(3, 6, 5, .35);
  --card: rgba(255, 255, 255, .025);
  --card-hover: rgba(255, 255, 255, .05);
  --field: rgba(4, 8, 6, .5);
  --modal: #0d1c15;
  --ink: #eef1ee; --ink2: #c9d1cc; --ink3: #93a59c; --ink4: #66766e;
  --rule: rgba(238, 241, 238, .10); --rule2: rgba(238, 241, 238, .20);
  --gold: #d6b13d; --gold2: #e8cf8a;
  --btn: #3a2314; --btn-hover: #4a2d1a; --btn-ink: #f1e2cc;
  --open: #7fc7a3; --review: #e0c46a; --close: #f0b77a; --done: #93a59c;
  --danger: #f0a58e;
  --logo-ink: #e6ebe8;
  --avatar: #11261c; --avatar-ink: #f1f5f2;
  color-scheme: dark;
}

[data-theme="brown"] {
  --bg: linear-gradient(100deg, #22150b 0%, #352112 34%, #4f331d 72%, #634127 100%);
  --bg-solid: #3a2414;
  --head: #150c06;
  --rail: rgba(18, 10, 4, .32);
  --card: rgba(255, 244, 230, .03);
  --card-hover: rgba(255, 244, 230, .06);
  --field: rgba(18, 10, 4, .45);
  --modal: #2c1b0f;
  --ink: #f6eee4; --ink2: #ddcfbd; --ink3: #b59f86; --ink4: #8a7561;
  --rule: rgba(246, 238, 228, .12); --rule2: rgba(246, 238, 228, .22);
  --btn: #1c1009; --btn-hover: #2a180c; --btn-ink: #f1e2cc;
  --open: #9fd6b9; --review: #ecd27e; --close: #f4c08a; --done: #b59f86;
  --logo-ink: #f6eee4;
  --avatar: #2a190d; --avatar-ink: #f6eee4;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f5f2ec;
  --bg-solid: #f5f2ec;
  --head: #f5f2ec;
  --rail: transparent;
  --card: #fbf9f5;
  --card-hover: #ffffff;
  --field: #fbf9f5;
  --modal: #fbf9f5;
  --ink: #191a1c; --ink2: #464b50; --ink3: #6b7075; --ink4: #8f887e;
  --rule: #ddd6c8; --rule2: #c9c0ae;
  --gold: #a8871f; --gold2: #8a6d1f;
  --btn: #3a2314; --btn-hover: #4a2d1a; --btn-ink: #f1e2cc;
  --open: #1f4a37; --review: #8a6d1f; --close: #8c5322; --done: #6b7075;
  --danger: #a3402a;
  --logo-ink: #191a1c;
  --avatar: #11261c; --avatar-ink: #f1f5f2;
  color-scheme: light;
}

* { box-sizing: border-box; }
/* Единая прокрутка без видимых ползунков: колесо, тачпад, касание и клавиатура работают нативно. */
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg-solid);
  color: var(--ink);
  font-family: 'Onest', system-ui, sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body::before { content: ""; position: fixed; inset: 0; z-index: -1; background: var(--bg); }
input, textarea, select, button { font-family: inherit; font-size: inherit; color: inherit; }
::placeholder { color: var(--ink4); }
::selection { background: rgba(214, 177, 61, .25); }
a { color: var(--gold2); text-decoration: none; }
a:hover { color: var(--gold); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
[hidden] { display: none !important; }
select option { background: var(--modal); color: var(--ink); }

.mono { font-family: 'IBM Plex Mono', monospace; }
.muted { color: var(--ink3); }
.faint { color: var(--ink4); }
.lbl { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--ink4); }

/* логотип */
.logo { display: block; flex-shrink: 0; }
.logo-ink { fill: var(--logo-ink); }
.gold-line { display: block; height: 1px; background: linear-gradient(90deg, rgba(195,144,67,0), #f8d97b 50%, rgba(195,144,67,0)); }

/* кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border: 1px solid transparent; border-radius: 10px;
  font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
  background: transparent; color: var(--ink); text-decoration: none; transition: background .15s, border-color .15s, color .15s;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--btn); color: var(--btn-ink); }
.btn-primary:hover:not(:disabled) { background: var(--btn-hover); color: var(--btn-ink); }
.btn-ghost { border-color: var(--rule2); color: var(--ink2); }
.btn-ghost:hover:not(:disabled) { border-color: var(--gold); color: var(--gold2); }
.btn-danger { border-color: rgba(240,165,142,.45); color: var(--danger); }
.btn-danger:hover:not(:disabled) { border-color: var(--danger); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-wide { width: 100%; }
.icon-btn {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--rule); border-radius: 8px; background: transparent; color: var(--ink3);
  font-size: 16px; line-height: 1; cursor: pointer; flex-shrink: 0;
}
.icon-btn:hover { border-color: var(--gold); color: var(--gold2); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }

/* поля */
.field {
  width: 100%; height: 42px; padding: 0 13px; border: 1px solid var(--rule2); border-radius: 10px;
  background: var(--field); color: var(--ink); outline: none; transition: border-color .15s;
}
textarea.field { height: auto; min-height: 84px; padding: 10px 13px; resize: vertical; line-height: 1.5; }
.field:focus { border-color: var(--gold); }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row > label { font-size: 12.5px; font-weight: 500; color: var(--ink3); }
.form-row > label small { font-weight: 400; color: var(--ink4); }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.hint { font-size: 12px; color: var(--ink4); }
.text-limit { display: block; overflow-wrap: anywhere; line-height: 1.5; }
textarea[data-user-text] { max-height: 16rem; overflow: auto; }
.user-copy { min-width: 0; max-width: 100%; }
.user-clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--text-lines, 4); line-clamp: var(--text-lines, 4); overflow: hidden; overflow-wrap: anywhere; white-space: pre-wrap; line-height: 1.6; max-height: calc(var(--text-lines, 4) * 1.6em); }
.text-more { display: block; margin-top: 5px; padding: 0; border: 0; background: transparent; color: var(--gold2); font: inherit; font-size: 11.5px; cursor: pointer; }
.text-more:hover { text-decoration: underline; }
.user-fulltext { min-width: 0; max-height: 60dvh; overflow: auto; overflow-wrap: anywhere; white-space: pre-wrap; line-height: 1.6; }
.hint.err { color: var(--danger); }
.hint.ok { color: var(--open); }

/* чипы-фильтры: выбранный подчёркнут золотом */
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; }
.chip {
  border: none; background: transparent; padding: 4px 0 5px; cursor: pointer;
  font-size: 13.5px; color: var(--ink3); border-bottom: 1.5px solid transparent;
}
.chip:hover { color: var(--ink); }
.chip.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--gold); }
.chip .n { margin-left: 5px; font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink4); }

/* технологии */
.tech {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px;
  border: 1px solid var(--rule2); border-radius: 7px; font-size: 12.5px; color: var(--ink2); white-space: nowrap;
}
.tech-ico { width: 14px; height: 14px; display: block; }
.tech.hit { border-color: rgba(127,199,163,.55); color: var(--ink); }
.tech.miss { opacity: .62; }
.techs { display: flex; flex-wrap: wrap; gap: 6px; }

/* статусы */
.status {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 600; letter-spacing: .4px;
  border: 1px solid currentColor; white-space: nowrap;
}
.status-open, .status-draft { color: var(--open); }
.status-review { color: var(--review); }
.status-close, .status-working { color: var(--close); }
.status-done, .status-finished { color: var(--done); }

/* аватар — единый стиль */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 50%;
  background: var(--avatar); color: var(--avatar-ink); border: 1px solid rgba(238,241,238,.14);
  font-family: 'IBM Plex Mono', monospace; font-weight: 600; line-height: 1;
}

/* переключатель темы: три точки */
.theme-switch { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px; border: 1px solid var(--rule); border-radius: 999px; }
.theme-dot { width: 14px; height: 14px; border-radius: 50%; padding: 0; cursor: pointer; border: 1px solid var(--rule2); }
.theme-dot-green { background: #10261d; }
.theme-dot-brown { background: #634127; }
.theme-dot-light { background: #f5f2ec; }
.theme-dot.on { outline: 2px solid var(--gold); outline-offset: 2px; }

/* тосты */
#toasts { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  max-width: 520px; padding: 11px 18px; border-radius: 10px; background: #0d1c15; color: #f1f5f2;
  border: 1px solid rgba(238,241,238,.16); box-shadow: 0 18px 40px rgba(0,0,0,.35); font-size: 13.5px;
  transition: opacity .3s, transform .3s;
}
.toast-err { border-color: rgba(240,165,142,.55); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* модальное окно */
.modal-wrap { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(0,0,0,.55); }
.modal {
  width: 100%; max-width: 480px; max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  background: var(--modal); border: 1px solid var(--rule2); border-radius: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.45);
}
.modal-wide { max-width: 760px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px 14px; border-bottom: 1px solid var(--rule); }
.modal-head h3 { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 17px; }
.modal-head p { margin-top: 4px; font-size: 13px; color: var(--ink3); }
.modal-body { padding: 18px 22px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-err { margin: 0 22px; padding: 9px 12px; border-radius: 8px; border: 1px solid rgba(240,165,142,.45); color: var(--danger); font-size: 13px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 18px; }

/* выбор технологий с поиском */
.picker { display: flex; flex-direction: column; gap: 8px; position: relative; }
.picker-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.picker-chips:empty { display: none; }
.picker-tag {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 4px 0 10px;
  border: 1px solid var(--gold); border-radius: 7px; font-size: 12.5px; color: var(--ink);
}
.picker-tag button { border: none; background: transparent; color: var(--ink3); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; }
.picker-tag button:hover { color: var(--danger); }
.picker-count { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink4); }
.picker-sugg {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 20; margin-top: 4px; max-height: 260px; overflow: auto;
  display: flex; flex-direction: column; background: var(--modal); border: 1px solid var(--rule2); border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
}
.picker-sugg:empty { display: none; }
.picker-sugg button {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: none; background: transparent;
  text-align: left; cursor: pointer; color: var(--ink2); font-size: 13.5px;
}
.picker-sugg button:hover { background: var(--card-hover); color: var(--ink); }
.picker-sugg .muted { padding: 10px 12px; font-size: 13px; }

.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; color: var(--ink2); user-select: none; }
.check input { width: 16px; height: 16px; accent-color: #b87333; margin: 0; }
