:root {
  --bg: #0b1020;
  --panel: rgba(18, 25, 46, 0.9);
  --panel-2: rgba(24, 32, 59, 0.95);
  --line: rgba(255, 255, 255, 0.09);
  --text: #eef3ff;
  --muted: #a8b3cf;
  --accent: #7c9cff;
  --accent-2: #8ef0d0;
  --planned: #7ea1ff;
  --progress: #ffbf69;
  --done: #77e4a1;
  --danger: #ff8b8b;
  --shadow: 0 20px 50px rgba(0,0,0,.35);
  --radius: 22px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at -10% -10%, rgba(124,156,255,.18), transparent 55%),
    radial-gradient(1000px 600px at 110% 10%, rgba(142,240,208,.12), transparent 50%),
    linear-gradient(180deg, #09101d 0%, #0d1326 100%);
  overflow: hidden;
}

button, input { font: inherit; }

.shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 14px;
  padding: 14px;
}

.topbar, .toolbar {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  min-height: 82px;
}

.title-wrap { min-width: 0; flex: 1 1 auto; }
.title-search-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}
.title-search-row h1 {
  flex: 0 0 auto;
  white-space: nowrap;
}
.title-wrap h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.title-wrap p {
  margin: 6px 0 0;
  color: var(--muted);
  max-width: 980px;
  font-size: 13px;
}

.search-wrap {
  position: relative;
  margin-top: 0;
  max-width: none;
  flex: 1 1 420px;
  min-width: 260px;
  z-index: 80;
}
.search-input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.055);
  color: var(--text);
  outline: none;
  border-radius: 16px;
  padding: 10px 13px;
  font: inherit;
  font-size: 14px;
}
.search-input::placeholder { color: #8c98b8; }
.search-input:focus {
  border-color: rgba(142,240,208,.42);
  background: rgba(255,255,255,.075);
}
.search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  display: none;
  gap: 6px;
  max-height: 320px;
  overflow: auto;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(14, 20, 38, 0.98);
  box-shadow: var(--shadow);
  z-index: 90;
}
.search-results.open { display: grid; }
.search-result {
  width: 100%;
  border: 1px solid transparent;
  background: rgba(255,255,255,.035);
  color: var(--text);
  border-radius: 13px;
  padding: 7px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.search-result:hover {
  border-color: rgba(142,240,208,.28);
  background: rgba(255,255,255,.075);
}
.search-open-btn {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  padding: 3px 4px;
  display: grid;
  gap: 3px;
}
.search-link-btn {
  flex: 0 0 auto;
  border: 1px solid rgba(142,240,208,.25);
  background: rgba(142,240,208,.08);
  color: #dffcf4;
  border-radius: 11px;
  padding: 7px 9px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}
.search-link-btn:hover { background: rgba(142,240,208,.16); }
.search-link-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  background: rgba(255,255,255,.035);
  color: var(--muted);
  border-color: var(--line);
}
.search-result-title { font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.search-result-meta { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.search-empty {
  color: var(--muted);
  font-size: 12px;
  padding: 9px 10px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  flex-shrink: 0;
}

.stats-badge, .badge {
  white-space: nowrap;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(124,156,255,.12);
  border: 1px solid rgba(124,156,255,.22);
  color: #dfe7ff;
  font-size: 13px;
}

.icon-btn, .button, .btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.05);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  transition: .18s ease;
}
.icon-btn:hover, .button:hover, .btn:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,.09);
}
.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 22px;
  line-height: 1;
}
.button, .btn {
  padding: 10px 13px;
  border-radius: 15px;
}
.button.primary, .btn.primary {
  background: linear-gradient(180deg, rgba(124,156,255,.26), rgba(124,156,255,.14));
  border-color: rgba(124,156,255,.34);
}
.button.good, .btn.good {
  background: linear-gradient(180deg, rgba(119,228,161,.2), rgba(119,228,161,.1));
  border-color: rgba(119,228,161,.28);
}
.button.danger, .btn.danger {
  background: linear-gradient(180deg, rgba(255,139,139,.2), rgba(255,139,139,.1));
  border-color: rgba(255,139,139,.28);
  color: #ffd7d7;
}

.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(14, 20, 38, 0.98);
  box-shadow: var(--shadow);
  display: none;
  z-index: 50;
}
.menu.open { display: grid; gap: 6px; }
.menu .button, .menu .btn {
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border-radius: 13px;
}

.toolbar {
  position: relative;
  z-index: 1;
  padding: 12px 14px;
  display: grid;
  gap: 10px;
}
.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.crumbs, .breadcrumbs { gap: 6px; }
.crumbs button, .crumb {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  padding: 7px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: .18s ease;
  font-size: 13px;
}
.crumbs button:hover, .crumb:hover { transform: translateY(-1px); background: rgba(255,255,255,.07); }
body.is-dragging .crumbs button { outline: 1px dashed rgba(124,156,255,.26); outline-offset: 2px; }
.crumbs button.crumb-drop {
  background: rgba(142,240,208,.13);
  border-color: rgba(142,240,208,.56);
  color: #dcfff6;
  box-shadow: 0 0 0 4px rgba(142,240,208,.08);
  transform: translateY(-1px);
}
.crumb-sep { opacity: .45; color: var(--muted); }

.composer, .creator {
  display: grid;
  grid-template-columns: 1.25fr 1.75fr auto auto;
  gap: 10px;
}
.composer input, .input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.05);
  color: var(--text);
  outline: none;
  border-radius: 16px;
  padding: 11px 13px;
  font: inherit;
}
.composer input::placeholder, .input::placeholder { color: #8c98b8; }
.composer input:focus, .input:focus { border-color: rgba(124,156,255,.42); background: rgba(255,255,255,.07); }
.muted-note, .hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  min-height: 17px;
}

.board {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(var(--columns-count, 3), minmax(270px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.column {
  min-height: 0;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.column.drag-over { outline: 1px dashed rgba(124,156,255,.42); outline-offset: -8px; }
.column-head, .column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01));
}
.column-title {
  min-width: 0;
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 700;
  font-size: 15px;
}
.column-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.column-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
}
.column-tools {
  display: flex;
  align-items: center;
  gap: 5px;
}
.column-icon {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.045);
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 13px;
  line-height: 1;
  transition: .18s ease;
}
.column-icon:hover {
  transform: translateY(-1px);
  color: var(--text);
  background: rgba(255,255,255,.09);
}
.column-icon.delete { color: #ffcaca; }
.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(255,255,255,.04);
}
.dot.planned { background: var(--planned); }
.dot.in_progress, .dot.progress { background: var(--progress); }
.dot.done { background: var(--done); }
.count {
  color: var(--muted);
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
}
.cards, .column-body {
  min-height: 0;
  overflow: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed rgba(255,255,255,.09);
  border-radius: 20px;
  padding: 18px;
}

.card {
  position: relative;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.03));
  border-radius: 22px;
  padding: 13px;
  display: grid;
  gap: 9px;
  cursor: grab;
  user-select: none;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, opacity .18s ease;
}
.card:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,.16);
  background: linear-gradient(180deg, rgba(255,255,255,.075), rgba(255,255,255,.035));
}
.card:active { cursor: grabbing; }
.card.dragging { opacity: .55; transform: rotate(1deg) scale(.99); }
.card.link-card { border-style: dashed; }
.card.highlighted {
  border-color: rgba(142,240,208,.8);
  box-shadow: 0 0 0 2px rgba(142,240,208,.18), 0 16px 34px rgba(0,0,0,.25);
  animation: highlightPulse 1.5s ease-in-out 2;
}
@keyframes highlightPulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
.card.drop-inside { outline: 2px solid rgba(142,240,208,.78); outline-offset: 3px; }
.card.drop-before::before, .card.drop-after::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
  box-shadow: 0 0 18px rgba(124,156,255,.45);
  pointer-events: none;
  z-index: 5;
}
.card.drop-before::before { top: -7px; }
.card.drop-after::after { bottom: -7px; }

.card-top { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.card-main { min-width: 0; cursor: pointer; padding-right: 36px; }
.card-title { margin: 0; font-size: 16px; line-height: 1.25; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.card-desc { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.badges { display: flex; flex-wrap: wrap; gap: 7px; }
.badge {
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--muted);
}
.badge.link { background: rgba(124,156,255,.12); border-color: rgba(124,156,255,.23); color: #dbe4ff; }

.nest-zone {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(142,240,208,.36);
  background: rgba(142,240,208,.11);
  color: #c7ffef;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transform: scale(.92);
  transition: .16s ease;
  z-index: 10;
}
body.is-dragging .nest-zone { opacity: .42; pointer-events: auto; }
body.is-dragging .card:hover .nest-zone, .nest-zone.over { opacity: 1; transform: scale(1); }
.nest-zone::after {
  content: 'внутрь';
  position: absolute;
  right: 0;
  top: 34px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(14,20,38,.96);
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 10px;
  opacity: 0;
  transform: translateY(-2px);
  white-space: nowrap;
  pointer-events: none;
}
.nest-zone.over::after { opacity: 1; transform: translateY(0); }

.actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-start; }
.small {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  padding: 7px 9px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 12px;
}
.small:hover { background: rgba(255,255,255,.09); transform: translateY(-1px); }
.small.delete { color: #ffd1d1; }
input[type="file"] { display: none; }

@media (max-width: 1050px) {
  body { overflow: auto; }
  .shell { height: auto; }
  .board { grid-template-columns: 1fr !important; overflow-x: visible; }
  .composer, .creator { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .title-wrap { width: 100%; }
  .title-search-row { flex-direction: column; align-items: stretch; }
  .title-search-row h1 { white-space: normal; }
  .topbar-right { width: 100%; justify-content: space-between; }
  .search-wrap { width: 100%; max-width: none; flex-basis: auto; min-width: 0; }
  .card-main { padding-right: 0; }
  .nest-zone { top: 8px; right: 8px; }
}
