/* Vektor RP — канбан-доска. Чёрно-белая тема. */

:root {
  --bg: #09090b;
  --surface: #121215;
  --surface-2: #18181c;
  --surface-3: #202026;
  --border: #26262c;
  --border-strong: #3a3a42;
  --text: #f4f4f5;
  --text-2: #b4b4bc;
  --text-3: #8a8a94;
  --accent: #f4f4f5;
  --accent-text: #0a0a0b;
  --danger: #f87171;
  --danger-bg: #2a1215;
  --success: #e4e4e7;
  --focus: #ffffff;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 1px 0 rgba(255, 255, 255, .03) inset;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: "Cascadia Code", Consolas, ui-monospace, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
main { outline: none; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 24px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; }
p { margin: 0 0 .75em; }
a { color: var(--text); }
code, kbd { font-family: var(--mono); font-size: 12px; }
code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
kbd {
  display: inline-block; min-width: 18px; padding: 0 5px; border: 1px solid var(--border-strong);
  border-bottom-width: 2px; border-radius: 4px; color: var(--text-2); text-align: center; line-height: 16px;
}
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 8px; top: -40px; z-index: 100; background: var(--accent); color: var(--accent-text); padding: 6px 10px; border-radius: 6px; }
.skip-link:focus { top: 8px; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

/* ---------------------------------------------------------------- кнопки */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font: 500 13px var(--font); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s, opacity .15s;
}
.btn:hover { background: var(--surface-3); border-color: #50505a; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn-primary:hover { background: #d4d4d8; border-color: #d4d4d8; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-danger { background: var(--danger-bg); border-color: #5b2329; color: #fecaca; }
.btn-danger:hover { background: #3a161b; border-color: #7f2d35; }
.btn-discord { background: #5865f2; border-color: #5865f2; color: #fff; }
.btn-discord:hover { background: #4752c4; border-color: #4752c4; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn kbd { border-color: rgba(0, 0, 0, .25); color: inherit; opacity: .6; }
.btn .spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 34px; height: 34px;
  border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent;
  color: var(--text-2); cursor: pointer; font-size: 15px; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.link-btn { background: none; border: 0; padding: 0; color: var(--text-2); cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 2px; }
.link-btn:hover { color: var(--text); }
.row-gap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--accent); color: var(--accent-text); font-size: 11px; font-weight: 700;
}

/* ---------------------------------------------------------------- верхняя панель */

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  height: 58px; padding: 0 20px; background: rgba(9, 9, 11, .85);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: var(--accent-text); font-weight: 800; font-size: 16px;
}
.brand-mark-lg { width: 42px; height: 42px; font-size: 22px; border-radius: 11px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 13px; letter-spacing: .08em; }
.brand-text small { color: var(--text-3); font-size: 11px; }
.topbar-section { color: var(--text-3); padding-left: 16px; border-left: 1px solid var(--border); font-size: 13px; }
.topnav { display: flex; gap: 2px; margin-left: 8px; }
.topnav a {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 6px;
  color: var(--text-2); text-decoration: none; font-size: 13px;
}
.topnav a:hover { background: var(--surface-2); color: var(--text); }
.topnav a[aria-current="page"] { background: var(--surface-3); color: var(--text); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 8px; text-decoration: none; }
.user-chip:hover { background: var(--surface-2); }
.avatar {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-3); border: 1px solid var(--border-strong); font-size: 12px; font-weight: 700; flex: none;
}
.avatar-xs { width: 20px; height: 20px; font-size: 10px; }
.card-meta .avatar-xs { width: 16px; height: 16px; font-size: 9px; margin-right: 2px; }
img.avatar { object-fit: cover; padding: 0; }
.avatar-xl { width: 88px; height: 88px; font-size: 34px; border-width: 2px; }
.avatar-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.user-chip-text { display: flex; flex-direction: column; line-height: 1.15; }
.user-chip-text strong { font-size: 13px; font-weight: 600; }
.user-chip-text small { color: var(--text-3); font-size: 11px; }
.logout-form { margin: 0; }

.bell-wrap { position: relative; }
.bell-count {
  position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--accent); color: var(--accent-text); font-size: 10px; font-weight: 800;
  display: grid; place-items: center; line-height: 1;
}
.bell-panel {
  position: absolute; right: 0; top: 42px; width: min(380px, calc(100vw - 24px)); max-height: 70vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow);
  animation: pop .16s var(--ease);
}
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.bell-list { list-style: none; margin: 0; padding: 4px; }
.bell-item { display: block; width: 100%; text-align: left; padding: 10px; border-radius: 8px; border: 0; background: none; color: var(--text); font: inherit; cursor: pointer; }
.bell-item:hover { background: var(--surface-2); }
.bell-item.unread { background: var(--surface-2); }
.bell-item.unread::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: middle; }
.bell-item small { display: block; color: var(--text-3); }
.bell-empty { padding: 24px; text-align: center; color: var(--text-3); }

/* ---------------------------------------------------------------- доска: шапка и фильтры */

.board-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding: 24px 20px 12px; flex-wrap: wrap; }
.board-head-text p { margin: 0; }
.board-head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.view-switch { display: inline-flex; padding: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; }
.seg { border: 0; background: none; color: var(--text-3); padding: 5px 12px; border-radius: 6px; cursor: pointer; font: 500 13px var(--font); }
.seg[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 0 20px 14px; }
.search {
  display: flex; align-items: center; gap: 8px; flex: 1 1 260px; max-width: 380px; height: 36px; padding: 0 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-3);
}
.search:focus-within { border-color: var(--border-strong); }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--text); font: inherit; height: 100%; }
.quick-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.chip-btn {
  height: 30px; padding: 0 11px; border-radius: 15px; border: 1px solid var(--border); background: transparent;
  color: var(--text-2); cursor: pointer; font: 500 12px var(--font); transition: all .15s;
}
.chip-btn:hover { border-color: var(--border-strong); color: var(--text); }
.chip-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chip-btn .n { opacity: .65; margin-left: 4px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filters select { height: 32px; font-size: 12px; line-height: 1.2; padding: 0 28px 0 10px; max-width: 170px; }
.filters select.active { border-color: var(--text-2); color: var(--text); }
.result-count { width: 100%; margin: 0; color: var(--text-3); font-size: 12px; }

/* ---------------------------------------------------------------- колонки */

.board {
  display: flex; gap: 12px; padding: 4px 20px 16px; overflow-x: auto; align-items: flex-start;
  scroll-snap-type: x proximity; min-height: 60vh;
}
.board-loading { padding: 40px; }
.column {
  flex: 0 0 300px; display: flex; flex-direction: column; max-height: calc(100vh - 230px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; scroll-snap-align: start;
  transition: border-color .15s, background .15s;
}
.column-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.column-kind { width: 8px; height: 8px; border-radius: 2px; border: 1.5px solid var(--text-2); flex: none; }
.column-kind.k-work { background: var(--text-2); border-radius: 50%; }
.column-kind.k-review { border-radius: 50%; }
.column-kind.k-done { background: var(--text); border-color: var(--text); }
.column-title { font-size: 13px; font-weight: 650; margin: 0; flex: 1; }
.column-count { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.column-count.over { color: var(--danger); font-weight: 700; }
.column-body { display: flex; flex-direction: column; gap: 8px; padding: 4px 8px 10px; overflow-y: auto; min-height: 80px; }
.column.drop-ok { border-color: var(--border-strong); border-style: dashed; }
.column.drop-over { border-color: var(--text); background: var(--surface-2); }
.column.drop-no { opacity: .45; }
.column-empty { border: 1px dashed var(--border); border-radius: 9px; padding: 18px 10px; text-align: center; color: var(--text-3); font-size: 12px; }

.column-tabs { display: none; }

/* ---------------------------------------------------------------- карточка */

.card {
  position: relative; display: block; width: 100%; text-align: left; padding: 11px 12px 10px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; color: var(--text);
  font: inherit; cursor: pointer; transition: border-color .15s, transform .15s var(--ease), box-shadow .15s, opacity .15s;
  animation: fadeIn .2s var(--ease);
}
.card:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
.card.dragging { opacity: .4; }
.card.pending { opacity: .55; pointer-events: none; }
.card.flash { animation: flash 1.2s var(--ease); }
.card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 11px; color: var(--text-3); }
.card-id { font-family: var(--mono); }
.card-title { font-weight: 600; font-size: 13.5px; line-height: 1.35; margin: 0 0 4px; word-break: break-word; }
.card-desc {
  color: var(--text-2); font-size: 12.5px; margin: 0 0 8px; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.card-foot { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 11.5px; }
.card-foot .spacer { flex: 1; }
.card-meta { display: inline-flex; align-items: center; gap: 3px; }
.card-meta svg { width: 13px; height: 13px; }
.card-returns { color: var(--text); font-weight: 600; }

.prio { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-2); white-space: nowrap; }
.prio-bars { display: inline-flex; gap: 1.5px; align-items: flex-end; height: 10px; }
.prio-bars i { width: 3px; background: var(--border-strong); border-radius: 1px; }
.prio-bars i:nth-child(1) { height: 4px; } .prio-bars i:nth-child(2) { height: 6px; }
.prio-bars i:nth-child(3) { height: 8px; } .prio-bars i:nth-child(4) { height: 10px; }
.prio[data-level="1"] .prio-bars i:nth-child(-n+1),
.prio[data-level="2"] .prio-bars i:nth-child(-n+2),
.prio[data-level="3"] .prio-bars i:nth-child(-n+3),
.prio[data-level="4"] .prio-bars i:nth-child(-n+4) { background: var(--text); }
.prio[data-level="4"] { color: var(--text); font-weight: 700; }
.card.lvl-4 { border-left: 3px solid var(--text); padding-left: 10px; }

.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 10px;
  border: 1px solid var(--border-strong); color: var(--text-2); font-size: 11px; background: transparent; line-height: 16px;
}
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px;
  background: var(--surface-3); color: var(--text-2); font-size: 11.5px; border: 1px solid var(--border);
}
.pill-strong { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }

/* ---------------------------------------------------------------- архив */

.archive { padding: 0 20px 20px; }
.archive-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.archive-row { display: flex; gap: 12px; align-items: center; width: 100%; padding: 12px 14px; background: var(--surface); border: 0; border-bottom: 1px solid var(--border); color: var(--text); text-align: left; font: inherit; cursor: pointer; }
.archive-row:hover { background: var(--surface-2); }
.archive-list li:last-child .archive-row { border-bottom: 0; }
.archive-row .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-3); border: 1px dashed var(--border); border-radius: 12px; }
.empty-state strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

.hotkeys { padding: 0 20px 24px; }

/* ---------------------------------------------------------------- формы */

input, select, textarea {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font: inherit; padding: 8px 10px; transition: border-color .15s, box-shadow .15s;
}
input, select { height: 36px; }
textarea { resize: vertical; min-height: 64px; line-height: 1.5; }
select {
  appearance: none; padding-top: 0; padding-bottom: 0; padding-right: 30px; line-height: 1.2; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
}
input:hover, select:hover, textarea:hover { border-color: #4a4a54; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px rgba(255, 255, 255, .08); }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: #f4f4f5; }
input::placeholder, textarea::placeholder { color: #5f5f68; }
input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(.8); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label, .label { font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.req { color: var(--text); }
.hint { margin: 0; font-size: 12px; color: var(--danger); min-height: 0; }
.hint:empty { display: none; }
.field.invalid input, .field.invalid textarea, .field.invalid select, .field.invalid .tag-input { border-color: var(--danger); }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.form-grid .field { grid-column: span 2; }
.form-grid .field-full { grid-column: 1 / -1; }
.form-error { background: var(--danger-bg); border: 1px solid #5b2329; color: #fecaca; padding: 10px 12px; border-radius: var(--radius-sm); margin: 0 0 12px; }
.checks { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.checks legend { font-size: 12.5px; font-weight: 550; color: var(--text-2); margin-bottom: 8px; padding: 0; }
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12px; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.draft-note { display: flex; gap: 10px; align-items: center; padding: 8px 12px; margin-bottom: 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; }

.tag-input {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 5px 6px; min-height: 36px;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.tag-input:focus-within { border-color: var(--text); }
.tag-input input { flex: 1; min-width: 160px; border: 0; height: 24px; padding: 0 4px; background: none; box-shadow: none !important; }
.tag-chips { display: contents; list-style: none; }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 8px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--border-strong); font-size: 12px; }
.tag-chip button { border: 0; background: none; color: var(--text-3); cursor: pointer; padding: 0 3px; font-size: 13px; line-height: 1; border-radius: 50%; }
.tag-chip button:hover { color: var(--text); }

.similar { margin-top: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); font-size: 12.5px; }
.similar strong { display: block; margin-bottom: 4px; }
.similar ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.similar a { color: var(--text-2); text-decoration: none; }
.similar a:hover { color: var(--text); text-decoration: underline; }

.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius); padding: 16px; text-align: center;
  cursor: pointer; transition: border-color .15s, background .15s; background: var(--bg);
}
.dropzone p { margin: 0; }
.dropzone:hover, .dropzone.over { border-color: var(--text-2); background: var(--surface-2); }
.thumbs { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { position: relative; width: 96px; height: 72px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border-strong); background: var(--bg); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.thumb button.rm { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .75); color: #fff; cursor: pointer; font-size: 12px; }
.thumb.uploading::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }

.mention-menu {
  position: fixed; z-index: 1000; min-width: 220px; max-height: 220px; overflow: auto; list-style: none; margin: 0; padding: 4px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px; box-shadow: var(--shadow);
}
.mention-menu li { padding: 6px 8px; border-radius: 6px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.mention-menu li[aria-selected="true"], .mention-menu li:hover { background: var(--surface-3); }
.mention-menu small { color: var(--text-3); }
.mention { font-weight: 600; color: var(--text); background: var(--surface-3); padding: 0 3px; border-radius: 4px; }

/* ---------------------------------------------------------------- модальные окна */

dialog.modal {
  padding: 0; border: 1px solid var(--border-strong); border-radius: 14px; background: var(--surface); color: var(--text);
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: var(--shadow);
}
dialog.modal[open] { animation: pop .18s var(--ease); }
dialog.modal::backdrop { background: rgba(0, 0, 0, .65); backdrop-filter: blur(2px); animation: fadeIn .18s; }
.modal-wide { width: min(940px, calc(100vw - 24px)) !important; }
.modal-sm { width: min(420px, calc(100vw - 24px)) !important; }
.modal-inner { padding: 20px 22px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 18px; word-break: break-word; }
.modal-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.modal-image { background: transparent !important; border: 0 !important; width: auto !important; max-width: 95vw; box-shadow: none !important; }
.modal-image img { max-width: 95vw; max-height: 90vh; display: block; border-radius: 8px; }
.image-close { position: fixed; top: 14px; right: 14px; background: var(--surface) !important; }

/* подробности */
.details-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text-3); font-size: 12px; margin-bottom: 6px; }
.details-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 16px; }
.details-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 22px; }
.details-section { margin-bottom: 18px; }
.details-section h3 { color: var(--text-3); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 650; margin-bottom: 6px; }
.prewrap { white-space: pre-wrap; word-break: break-word; margin: 0; }
.meta-list { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; font-size: 12.5px; align-content: start; }
.meta-list dt { color: var(--text-3); }
.meta-list dd { margin: 0; word-break: break-word; }
.meta-list select { height: 32px; font-size: 12.5px; line-height: 1.2; padding: 0 30px 0 10px; }
.side { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px; align-self: start; }
.tabs-mini { display: flex; gap: 4px; margin-bottom: 10px; border-bottom: 1px solid var(--border); }
.tabs-mini button { border: 0; background: none; color: var(--text-3); padding: 8px 10px; cursor: pointer; font: 600 13px var(--font); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs-mini button[aria-selected="true"] { color: var(--text); border-color: var(--text); }
.feed { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.feed-item { display: flex; gap: 10px; }
.feed-body { flex: 1; min-width: 0; }
.feed-head { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; }
.feed-head time { color: var(--text-3); font-size: 11.5px; }
.feed-text { margin: 2px 0 0; white-space: pre-wrap; word-break: break-word; }
.history-item { font-size: 12.5px; color: var(--text-2); }
.history-item strong { color: var(--text); font-weight: 600; }
.history-item time { color: var(--text-3); margin-left: 6px; font-size: 11.5px; }
.comment-form { display: flex; flex-direction: column; gap: 8px; }
.comment-form .row-gap { justify-content: space-between; }
.notice { padding: 8px 12px; border-radius: 8px; background: var(--surface-3); border: 1px solid var(--border-strong); display: flex; gap: 10px; align-items: center; font-size: 12.5px; margin-bottom: 12px; }

/* ---------------------------------------------------------------- тосты */

.toasts {
  position: fixed; inset: auto 20px 20px auto; z-index: 2147483647; display: flex; flex-direction: column; gap: 8px;
  width: min(380px, calc(100vw - 32px)); height: auto; pointer-events: none;
  /* сбрасываем стандартный вид popover */
  margin: 0; padding: 0; border: 0; background: transparent; color: inherit; overflow: visible;
}
.toasts:empty { display: none; }
.toast {
  pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; padding: 12px 12px 12px 14px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow);
  animation: toastIn .22s var(--ease);
}
.toast.leaving { animation: toastOut .2s var(--ease) forwards; }
.toast-icon { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; margin-top: 1px; }
.toast-success .toast-icon { background: var(--accent); color: var(--accent-text); }
.toast-error { border-color: #6b2a31; background: #1a0f11; }
.toast-error .toast-icon { background: var(--danger); color: #1a0f11; }
.toast-info .toast-icon { border: 1.5px solid var(--text-2); color: var(--text-2); }
.toast-text { flex: 1; margin: 0; word-break: break-word; }
.toast-close { border: 0; background: none; color: var(--text-3); cursor: pointer; font-size: 14px; padding: 0 2px; }
.toast-close:hover { color: var(--text); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }
@keyframes flash { 0%, 40% { border-color: var(--text); box-shadow: 0 0 0 3px rgba(255, 255, 255, .15); } }

/* ---------------------------------------------------------------- страницы входа / ошибок */

.page-auth main { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.auth-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.auth-brand div { display: flex; flex-direction: column; line-height: 1.2; }
.auth-brand strong { letter-spacing: .08em; }
.auth-brand small { color: var(--text-3); }
.error-code { font-size: 56px; font-weight: 800; margin: 0; letter-spacing: -.03em; color: var(--text-3); }

/* ---------------------------------------------------------------- профиль и админка */

.page-narrow { max-width: 720px; margin: 0 auto; padding: 28px 20px; }
.page-wide { max-width: 1100px; margin: 0 auto; padding: 28px 20px; }
.page-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.page-title-row h1, .page-title-row h2 { margin: 0; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.channel { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.channel:last-of-type { border-bottom: 0; margin-bottom: 12px; }
.channel-info { display: flex; flex-direction: column; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--text-3); }
.status-dot.on { background: var(--text); box-shadow: 0 0 0 3px rgba(255, 255, 255, .12); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 600; color: var(--text-3); font-size: 12px; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-pending td { background: var(--surface-2); }
.table select { height: 32px; font-size: 12.5px; line-height: 1.2; padding: 0 30px 0 10px; min-width: 170px; }
.table .who { display: flex; gap: 10px; align-items: center; }
.table .who small { display: block; color: var(--text-3); }

.tabs { display: flex; gap: 4px; margin: 12px 0 16px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs [role="tab"] { border: 0; background: none; color: var(--text-3); padding: 10px 14px; cursor: pointer; font: 600 13.5px var(--font); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs [role="tab"][aria-selected="true"] { color: var(--text); border-color: var(--text); }
.settings-list { list-style: none; margin: 12px 0 0; padding: 0; border: 1px solid var(--border); border-radius: 10px; }
.settings-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.settings-list > li:last-child .settings-row, .settings-list > li:last-child.settings-row { border-bottom: 0; }
.settings-row .grow { flex: 1; min-width: 160px; }
.settings-row .grow small { display: block; color: var(--text-3); }
.settings-row.inactive .grow { opacity: .5; }
.lists-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.list-box h3 { margin-bottom: 8px; }
.add-row { display: flex; gap: 8px; margin-top: 8px; }
.add-row input { height: 32px; }

/* ---------------------------------------------------------------- адаптивность */

@media (max-width: 1000px) {
  .topbar-section, .user-chip-text { display: none; }
  .details-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .topbar { padding: 0 12px; gap: 8px; height: 54px; }
  .brand-text { display: none; }
  .topnav { margin-left: 0; overflow-x: auto; }
  .topnav a { padding: 6px 8px; }
  .logout-form .btn { padding: 0 8px; }
  .board-head { padding: 18px 16px 10px; }
  .board-head-actions { width: 100%; }
  .board-head-actions .btn-primary { flex: 1; }
  .btn kbd, .search kbd, .hotkeys { display: none; }
  .toolbar { padding: 0 16px 12px; }
  .search { max-width: none; flex-basis: 100%; }
  .quick-tabs { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; }
  .chip-btn { flex: none; }
  .filters select { max-width: none; flex: 1 1 45%; }

  /* На телефоне колонки — вкладками */
  .column-tabs {
    display: flex; gap: 6px; overflow-x: auto; padding: 0 16px 10px; position: sticky; top: 54px; z-index: 5;
    background: var(--bg);
  }
  .column-tabs button {
    flex: none; height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text-2); font: 600 13px var(--font); cursor: pointer;
  }
  .column-tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
  .board { padding: 0 16px 16px; display: block; overflow: visible; min-height: 0; }
  .column { display: none; max-height: none; }
  .column.mobile-active { display: flex; }
  .column-body { overflow: visible; }

  .form-grid { grid-template-columns: 1fr; }
  .form-grid .field { grid-column: 1 / -1; }
  dialog.modal { width: 100vw !important; max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; border: 0; }
  .modal-inner { padding: 16px; }
  .modal-foot { position: sticky; bottom: -16px; background: var(--surface); padding-bottom: 16px; }
  .toasts { inset: auto 16px 16px 16px; width: auto; }
  .page-narrow, .page-wide { padding: 20px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.m0 { margin: 0; }

/* журнал действий */
.nowrap { white-space: nowrap; }
.block { display: block; }
.audit-filters { margin: 8px 0 12px; }
.audit-filters input { height: 32px; max-width: 280px; flex: 1 1 200px; font-size: 12.5px; }
.audit-table td { vertical-align: top; }
.audit-table .who small { display: block; color: var(--text-3); }
.audit-details { word-break: break-word; max-width: 420px; }
.audit-warn td { background: var(--danger-bg); }
.audit-more { margin-top: 12px; justify-content: center; }
