/* Поток — командная доска. Тёмный сланец + лаванда. */
:root {
  --bg: #0b0d13;
  --bg-deep: #080a0f;
  --surface: #12151f;
  --surface-2: #171b28;
  --surface-3: #1d2232;
  --line: #252b3d;
  --line-soft: #1c2130;
  --text: #f2efe9;
  --text-dim: #a9aec0;
  --text-faint: #767c92;
  --accent: #a78bfa;
  --accent-strong: #8b5cf6;
  --accent-deep: #6d43e8;
  --accent-soft: rgba(167, 139, 250, 0.13);
  --danger: #f4736b;
  --ok: #6ee7b7;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.9);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(60rem 32rem at 12% -10%, rgba(139, 92, 246, 0.2), transparent 62%),
    radial-gradient(48rem 28rem at 92% 4%, rgba(96, 120, 255, 0.13), transparent 60%),
    linear-gradient(180deg, #0d1019 0%, var(--bg-deep) 70%);
}
body::after {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(90% 70% at 50% 0%, #000, transparent 78%);
  mask-image: radial-gradient(90% 70% at 50% 0%, #000, transparent 78%);
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(167, 139, 250, 0.32); }
[hidden] { display: none !important; }

.shell { max-width: 1320px; margin: 0 auto; padding: 20px clamp(12px, 3vw, 30px) 90px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 15px; border-radius: 11px;
  font-size: 13.5px; font-weight: 560;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text-dim);
  transition: background 0.18s var(--ease), color 0.18s var(--ease),
    border-color 0.18s var(--ease), transform 0.12s var(--ease);
}
.btn:hover { background: var(--surface-3); color: var(--text); border-color: #333b52; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(180deg, var(--accent-strong), var(--accent-deep));
  border-color: rgba(167, 139, 250, 0.55); color: #fff;
  box-shadow: 0 10px 22px -12px rgba(139, 92, 246, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-primary:hover { background: linear-gradient(180deg, #9b74fb, #7a52ef); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--danger); border-color: rgba(244, 115, 107, 0.32); }
.btn-danger:hover { background: rgba(244, 115, 107, 0.12); color: #ff9a94; border-color: rgba(244, 115, 107, 0.5); }
.btn-sm { padding: 6px 10px; font-size: 12.5px; border-radius: 9px; }
.btn-icon { padding: 9px; width: 36px; justify-content: center; }

/* ---------------- login ---------------- */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(410px, 100%); padding: 30px 28px 26px;
  background: linear-gradient(180deg, rgba(23, 27, 40, 0.88), rgba(18, 21, 31, 0.82));
  border: 1px solid var(--line-soft); border-radius: 20px; box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.login-card .brand { margin-bottom: 22px; }
.login-card h1 { margin: 0 0 4px; font-size: 20px; letter-spacing: -0.015em; }
.login-card p.hint { margin: 0 0 22px; color: var(--text-faint); font-size: 13px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 12px; letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 620; margin-bottom: 6px; }
.input, .textarea, .select {
  width: 100%; padding: 10px 12px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent); background: var(--surface-2); outline: none;
}
.textarea { min-height: 86px; resize: vertical; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-faint) 50%),
  linear-gradient(135deg, var(--text-faint) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.alert {
  margin: 0 0 14px; padding: 10px 12px; border-radius: 11px; font-size: 13px;
  border: 1px solid rgba(244, 115, 107, 0.4); background: rgba(244, 115, 107, 0.1); color: #ffb0aa;
}
.alert-ok { border-color: rgba(110, 231, 183, 0.35); background: rgba(110, 231, 183, 0.09); color: #a9f0d3; }

/* ---------------- header ---------------- */
header.top {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 18px;
  background: linear-gradient(180deg, rgba(23, 27, 40, 0.86), rgba(18, 21, 31, 0.74));
  border: 1px solid var(--line-soft); border-radius: 18px;
  backdrop-filter: blur(14px); box-shadow: var(--shadow);
  position: sticky; top: 8px; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand .mark { color: var(--accent); flex: none; display: block; }
.brand h1 { margin: 0; font-size: 16px; letter-spacing: -0.01em; font-weight: 650; white-space: nowrap; }
.brand .sub { display: block; font-size: 11.5px; color: var(--text-faint); font-weight: 450; }
.spacer { flex: 1 1 auto; }
.whoami { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--text-faint); }
.role-pill {
  padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 650;
  background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(167, 139, 250, 0.28);
}
.role-pill[data-role="worker"] { background: rgba(255, 255, 255, 0.05); color: var(--text-dim); border-color: var(--line); }
.dot-live { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); opacity: 0.35;
  transition: opacity 0.3s var(--ease); }
.dot-live[data-active="true"] { opacity: 1; }

/* ---------------- bars ---------------- */
.bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px; padding: 10px 13px;
  background: rgba(18, 21, 31, 0.58); border: 1px solid var(--line-soft); border-radius: 14px;
}
.bar-title {
  font-size: 11.5px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-faint); flex: none;
}
.chips { display: flex; align-items: center; gap: 7px; flex: 1; flex-wrap: wrap; min-width: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 4px 5px 4px 10px;
  border: 1px solid var(--line); border-radius: 99px; background: var(--surface);
  font-size: 12.5px; color: var(--text-dim);
  transition: border-color 0.16s var(--ease), color 0.16s var(--ease), background 0.16s var(--ease);
}
button.chip:hover { border-color: #3a4260; color: var(--text); }
.chip b {
  min-width: 20px; padding: 1px 6px; border-radius: 99px; text-align: center;
  background: rgba(255, 255, 255, 0.06); color: var(--text-dim); font: 650 11px var(--mono);
}
.chip[aria-pressed="true"] {
  border-color: var(--accent); background: var(--accent-soft); color: var(--text);
}
.chip[aria-pressed="true"] b { background: rgba(167, 139, 250, 0.22); color: var(--accent); }
.chip[data-zero="true"] { opacity: 0.6; }
.swatch { width: 9px; height: 9px; border-radius: 50%; background: var(--cat, var(--accent)); flex: none; }
.filter-state { font-size: 12px; color: var(--text-faint); }
.filter-state b { color: var(--accent); font-weight: 620; }

/* ---------------- board ---------------- */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.col {
  background: linear-gradient(180deg, rgba(23, 27, 40, 0.55), rgba(18, 21, 31, 0.4));
  border: 1px solid var(--line-soft); border-radius: 16px; padding: 12px;
  min-height: 220px; transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}
.col[data-over="true"] { border-color: var(--accent); background: rgba(167, 139, 250, 0.06); }
.col-head { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; padding: 0 3px; }
.col-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.col[data-key="inbox"] .col-dot { background: #7c8cff; }
.col[data-key="doing"] .col-dot { background: var(--accent); }
.col[data-key="done"] .col-dot { background: var(--ok); }
.col-head h2 { margin: 0; font-size: 13.5px; font-weight: 640; letter-spacing: 0.01em; }
.col-count { font: 650 11.5px var(--mono); color: var(--text-faint); background: rgba(255, 255, 255, 0.05);
  padding: 1px 7px; border-radius: 99px; }
.col-list { display: flex; flex-direction: column; gap: 9px; min-height: 60px; }

.card {
  position: relative; padding: 11px 12px 10px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--line);
  box-shadow: 0 10px 24px -20px rgba(0, 0, 0, 0.9);
  transition: border-color 0.16s var(--ease), transform 0.12s var(--ease), opacity 0.16s var(--ease);
}
.card:hover { border-color: #333b52; }
.card[draggable="true"] { cursor: grab; }
.card.dragging { opacity: 0.42; }
.card-title { padding-right: 30px; font-size: 14px; font-weight: 570; letter-spacing: -0.005em; word-break: break-word; }
.card-details { margin-top: 5px; font-size: 12.5px; color: var(--text-dim); white-space: pre-wrap; word-break: break-word; }
.card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px;
  font-size: 11.5px; color: var(--text-dim); background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line-soft);
}
.badge-cat { border-color: var(--cat, var(--line)); }
.card-actions { display: flex; gap: 5px; margin-top: 9px; flex-wrap: wrap; }
.card-category-btn {
  position: absolute; top: 9px; right: 9px; z-index: 2;
  display: grid; place-items: center; width: 22px; height: 22px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface);
  transition: transform 0.14s var(--ease), border-color 0.14s var(--ease), background 0.14s var(--ease);
}
.card-category-btn:hover { transform: scale(1.08); border-color: var(--accent); background: var(--surface-3); }
.card-category-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--cat, transparent);
  border: 1px solid color-mix(in srgb, var(--cat, var(--text-faint)) 72%, white);
}
.card-category-dot:not(.has-color) {
  background: repeating-conic-gradient(var(--text-faint) 0 25%, transparent 0 50%) 50% / 5px 5px;
  border-color: var(--text-faint);
}
.drop-line { height: 2px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 10px rgba(167, 139, 250, 0.8); }

.empty { padding: 22px 12px; text-align: center; color: var(--text-faint); font-size: 12.5px; }
.empty svg { display: block; margin: 0 auto 8px; color: #3a4260; }
.skeleton { height: 62px; border-radius: var(--radius); background: linear-gradient(90deg, #171b28, #1d2232, #171b28);
  background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------------- modal ---------------- */
dialog {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 18px; padding: 0; width: min(620px, calc(100vw - 28px));
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.95);
}
dialog::backdrop { background: rgba(6, 8, 13, 0.66); backdrop-filter: blur(3px); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--line-soft); }
.modal-head h2 { margin: 0; font-size: 15px; font-weight: 640; }
.modal-body { padding: 16px 18px; max-height: min(66vh, 560px); overflow: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 13px 18px; border-top: 1px solid var(--line-soft); }
.tabs { display: flex; gap: 6px; padding: 10px 18px 0; flex-wrap: wrap; }
.tab { padding: 7px 12px; border-radius: 10px; font-size: 13px; color: var(--text-faint); }
.tab[aria-selected="true"] { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint);
  font-weight: 650; margin: 18px 0 9px; }
.section-title:first-child { margin-top: 0; }
.row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

.quick-category-hint { margin: 0 0 12px; color: var(--text-dim); font-size: 13px; }
.quick-category-hint b { color: var(--text); font-weight: 600; }
.quick-category-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.quick-category-choice {
  display: flex; align-items: center; gap: 9px; min-width: 0; min-height: 42px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); color: var(--text-dim);
  text-align: left; transition: border-color 0.14s var(--ease), background 0.14s var(--ease), color 0.14s var(--ease);
}
.quick-category-choice:hover { border-color: #3b4562; background: var(--surface-3); color: var(--text); }
.quick-category-choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.quick-category-swatch {
  width: 12px; height: 12px; flex: none; border: 1px solid var(--line); border-radius: 50%;
  background: var(--cat, repeating-conic-gradient(var(--text-faint) 0 25%, transparent 0 50%) 50% / 6px 6px);
}
.quick-category-choice > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-category-check { margin-left: auto; color: var(--accent); font-weight: 700; }
.quick-category-empty { grid-column: 1 / -1; margin: 4px 0 0; color: var(--text-faint); font-size: 12.5px; }
@media (max-width: 460px) { .quick-category-choices { grid-template-columns: 1fr; } }

table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-faint); font-weight: 640; padding: 6px 8px; border-bottom: 1px solid var(--line-soft); }
table.list td { padding: 8px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.list tr[data-inactive="true"] { opacity: 0.5; }
.mono { font-family: var(--mono); font-size: 12.5px; }

.credentials {
  margin-top: 12px; padding: 12px 14px; border-radius: 12px;
  border: 1px dashed rgba(167, 139, 250, 0.5); background: rgba(167, 139, 250, 0.08);
}
.credentials .mono { font-size: 14px; color: var(--text); }
.credentials p { margin: 0 0 6px; font-size: 12px; color: var(--text-dim); }

.history-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.history-item:last-child { border-bottom: 0; }
.history-main { flex: 1; min-width: 0; }
.history-main .t { font-size: 13.5px; font-weight: 560; word-break: break-word; }
.history-main .m { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.arrow { color: var(--accent); }
.undone-note { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; align-self: center; }

.toast-host { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 90;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; padding: 10px 15px; border-radius: 12px; font-size: 13px;
  background: var(--surface-3); border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: rise 0.2s var(--ease);
}
.toast[data-kind="error"] { border-color: rgba(244, 115, 107, 0.5); color: #ffb0aa; }
.toast[data-kind="ok"] { border-color: rgba(110, 231, 183, 0.4); color: #a9f0d3; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 1000px) {
  .board { grid-template-columns: 1fr; }
  header.top { position: static; }
}
@media (max-width: 640px) {
  .brand .sub { display: none; }
  .bar { gap: 8px; }
  .bar-title { width: 100%; }
  .col { min-height: 0; }
  .empty { padding: 14px 10px; }
  header.top { gap: 10px 8px; padding: 10px 12px; }
  .whoami { order: 3; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
