:root {
  --ink: #2b2f36;
  --muted: #7a8190;
  --line: #e3e6ea;
  --pill: #eef0f3;
  --card: #ffffff;
  --lane: rgba(246, 247, 249, .93);
  --accent: #8b3dff;
  --blue: #2f6feb;
  --green: #22a06b;
  --red: #e5484d;
  --amber: #f2a93b;
  --loop: #1e6fd9;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  color: var(--ink);
  font: 14px/1.35 -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  background-color: #0e1119;
  background-image:
    radial-gradient(1200px 600px at 75% -10%, rgba(120, 90, 220, .35), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(40, 90, 180, .3), transparent 60%),
    radial-gradient(1.4px 1.4px at 12% 22%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 28% 68%, #fff, transparent),
    radial-gradient(1.6px 1.6px at 44% 12%, #fff, transparent),
    radial-gradient(1.1px 1.1px at 58% 82%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 71% 38%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 86% 64%, #fff, transparent),
    radial-gradient(1.3px 1.3px at 93% 18%, #fff, transparent),
    radial-gradient(1px 1px at 36% 46%, #fff, transparent),
    radial-gradient(1px 1px at 65% 58%, #fff, transparent),
    radial-gradient(1px 1px at 8% 88%, #fff, transparent);
}

/* ── верхняя панель ─────────────────────────────── */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 6px 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.left, .right { display: flex; align-items: center; gap: 10px; }
.right { justify-content: flex-end; }
.logo { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 17px; }
.mark {
  width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid var(--blue);
  box-shadow: inset 0 0 0 2px #fff;
  background: #16305e;
}
.board-name { color: var(--ink); font-weight: 500; }
.board-name .heart { color: var(--red); margin-right: 5px; }
.kpi-box { position: relative; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.kpi-box > i { color: var(--muted); font-style: normal; font-size: 10px; text-transform: uppercase; letter-spacing: 2px; }
.kpi-box > b { font-size: 40px; font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.kpi-box.bump > b { animation: bump .25s; }
@keyframes bump { 50% { transform: scale(1.12); color: var(--green); } }
#combo {
  position: absolute; left: 100%; bottom: 3px; margin-left: 10px;
  color: var(--accent); font-size: 18px; font-weight: 700; white-space: nowrap;
  opacity: 0; transition: opacity .2s;
}
#combo.on { opacity: 1; }
.stat { display: flex; align-items: baseline; gap: 6px; }
.stat b { font-size: 18px; font-variant-numeric: tabular-nums; }
.stat i { color: var(--muted); font-style: normal; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; }
.year { display: flex; flex-direction: column; gap: 4px; min-width: 200px; }
.year-head { display: flex; align-items: baseline; gap: 8px; font-size: 12px; color: var(--muted); }
.year-head b { font-size: 15px; color: var(--ink); }
#yearbar { position: relative; height: 8px; background: var(--pill); border-radius: 4px; overflow: hidden; }
#yearbar > i { position: absolute; inset: 0; background: var(--accent); transform-origin: left; }
#yearbar.low > i { background: var(--red); }
#yearbar .tick { position: absolute; top: 0; bottom: 0; width: 1px; background: #fff; }
.ava { width: 26px; height: 26px; border-radius: 50%; background: var(--pill); display: grid; place-items: center; font-size: 14px; }

/* ── панель доски ───────────────────────────────── */
.toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line); border-radius: 6px;
  padding: 3px 9px; color: #4d5462; background: #fff;
}
.btn.purple { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.toolbar .spacer { flex: 1; }
.toolbar .hint { color: var(--muted); }
.toolbar kbd {
  background: var(--pill); border: 1px solid var(--line); border-radius: 4px;
  padding: 0 5px; font-size: 11px; font-family: inherit;
}

/* ── доска ──────────────────────────────────────── */
main { flex: 1; min-height: 0; padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.lane-head {
  display: flex; align-items: center; gap: 10px;
  color: #dfe3ee; font-size: 13px;
}
.lane-head .pill { background: rgba(255,255,255,.16); color: #fff; border: 0; }
.columns { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.col {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--lane);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.col.over { box-shadow: 0 0 0 2px var(--blue), 0 2px 10px rgba(0,0,0,.25); }
.col.nope { animation: shake .3s; box-shadow: 0 0 0 2px var(--red), 0 2px 10px rgba(0,0,0,.25); }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.col > h2 {
  margin: 0; padding: 9px 10px;
  font-size: 13px; font-weight: 500; color: #4d5462;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--pill); border-radius: 10px;
  padding: 1px 8px; font-size: 12px; color: #5a6270;
  font-variant-numeric: tabular-nums;
}
.pill.full { background: #ffe0e0; color: var(--red); }
.cards { flex: 1; overflow-y: auto; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 7px; }
.mood { padding: 6px 10px 9px; color: #5a6270; font-size: 12px; border-top: 1px solid rgba(0,0,0,.06); }

/* ── карточка ───────────────────────────────────── */
.card {
  position: relative;
  background: var(--card);
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(16,20,30,.25);
  padding: 8px 10px;
  cursor: grab;
  touch-action: none;
  flex: 0 0 auto;
}
.card .stripe { width: 44px; height: 4px; border-radius: 2px; background: var(--blue); }
.card.s .stripe { background: var(--blue); }
.card.m .stripe { background: var(--amber); }
.card.l .stripe { background: var(--red); }
.card.xl .stripe { background: var(--accent); }
.card.asap { box-shadow: 0 0 0 1px rgba(229,72,77,.55), 0 1px 2px rgba(16,20,30,.25); }
.card .flag {
background: #ffe2e2; color: var(--red); font-weight: 700;
font-size: 11px; border-radius: 4px; padding: 1px 6px;
}
.card .title { margin-top: 6px; font-size: 13.5px; }
.card .title .tag { color: var(--muted); }
.card .fields { margin-top: 8px; }
.card .fields.set { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card .fields .row { display: flex; align-items: center; gap: 3px; margin-top: 5px; }
.card .fields .lab { width: 54px; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.card .opt {
  margin: 0; flex: 1;
  background: #fff; color: #5a6270;
  border: 1px solid var(--line); border-radius: 5px;
  padding: 3px 0; font: inherit; font-size: 11px; font-weight: 600;
  cursor: pointer; text-align: center;
}
.card .opt:hover { background: #eef4ff; border-color: var(--blue); color: var(--ink); filter: none; }
.card .opt.sev-S1 { color: var(--red); }
.card .opt.sev-S2 { color: #b8790f; }
.card .opt.sev-S4 { color: #9aa3b2; }
.card .chip {
  background: var(--pill); border-radius: 5px;
  padding: 2px 8px; font-size: 11px; font-weight: 600; color: #5a6270;
}
.card .chip.sev-S1 { background: #ffe2e2; color: var(--red); }
.card .chip.sev-S2 { background: #fdeccd; color: #b8790f; }
.card .chip.sev-S3 { background: #e3ecff; color: var(--blue); }
.card .by { font-size: 10px; color: var(--muted); }
.card.raw { border-left-color: #c3c9d2 !important; cursor: default; }
.card[data-sev="S1"] .stripe { background: var(--red); }
.card[data-sev="S2"] .stripe { background: var(--amber); }
.card[data-sev="S3"] .stripe { background: var(--blue); }
.card[data-sev="S4"] .stripe { background: #9aa3b2; }
.card .stripe { background: #c3c9d2; }
.card .meta { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.card .gain { color: var(--muted); font-size: 12px; margin-right: auto; }
.card .pts {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid #d7dbe0; display: grid; place-items: center;
  font-size: 12px; color: #5a6270;
}
.card .who { width: 22px; height: 22px; border-radius: 50%; background: var(--pill); display: grid; place-items: center; font-size: 12px; }
.card .due {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--pill); border-radius: 4px; padding: 1px 6px;
  font-size: 12px; color: #5a6270; font-variant-numeric: tabular-nums;
}
.card.hot .due { background: #ffdcdc; color: var(--red); }
.card .ttl { height: 3px; margin: 8px -10px -8px; background: #eceff3; border-radius: 0 0 6px 6px; overflow: hidden; }
.card .ttl > i { display: block; height: 100%; background: var(--green); transform-origin: left; }
.card.hot .ttl > i { background: var(--red); }
.card.dragging { position: fixed; z-index: 50; pointer-events: none; cursor: grabbing; transform: rotate(-2deg); box-shadow: 0 14px 28px rgba(0,0,0,.45); }
.card.done { opacity: .62; cursor: default; }
.card.done .title::after { content: " ✓"; color: var(--green); }
.card.burn { animation: burn .35s forwards; }
@keyframes burn { to { opacity: 0; transform: scale(.85); } }
.card.pop { animation: pop .25s; }
@keyframes pop { 50% { transform: scale(1.05); } }

/* ── всплывашки Юры ─────────────────────────────── */
#toasts {
  position: fixed; bottom: 16px; right: 16px; z-index: 70;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  pointer-events: none; max-width: min(390px, 88vw);
}
.toast {
  width: min(390px, 88vw);
  text-align: left;
  background: #fff;
  border-radius: 10px;
  border-left: 4px solid var(--loop);
  padding: 9px 14px 12px;
  box-shadow: 0 10px 28px rgba(0,0,0,.45);
  animation: slide-in .22s cubic-bezier(.2,.9,.3,1.3);
}
.toast.out { animation: slide-out .25s forwards; }
.toast .head {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted);
  white-space: nowrap;
  padding-bottom: 8px; margin-bottom: 9px;
  border-bottom: 1px solid var(--line);
}
.toast .loop { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 600; }
.toast .loop-mark {
  width: 18px; height: 18px; border-radius: 5px;
  background: var(--loop); color: #fff;
  display: grid; place-items: center; font-size: 11px; line-height: 1;
}
.toast .chan { color: var(--loop); }
.toast .time { margin-left: auto; }
.toast .body { display: flex; align-items: center; gap: 12px; }
.toast .body > div { min-width: 0; }
.toast .face { width: 39px; height: 39px; border-radius: 50%; background: var(--pill); display: grid; place-items: center; font-size: 22px; flex: 0 0 auto; }
.toast .who { font-size: 13px; font-weight: 700; }
.toast .text { font-size: 18px; line-height: 1.22; margin-top: 2px; }
.toast.angry { border-left-color: var(--red); box-shadow: 0 10px 28px rgba(229,72,77,.45); }
.toast.ask { pointer-events: auto; border-left-color: var(--amber); box-shadow: 0 10px 28px rgba(242,169,59,.45); }
.toast .acts { display: grid; gap: 6px; margin-top: 11px; }
.toast .acts button {
  margin: 0; width: 100%;
  display: grid; grid-template-columns: auto 1fr auto; gap: 2px 8px; align-items: center;
  background: #f4f6f9; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; font: inherit; text-align: left; cursor: pointer;
}
.toast .acts button:hover { background: #e9eef6; border-color: var(--loop); filter: none; }
.toast .acts .key {
  width: 18px; height: 18px; border-radius: 4px;
  background: #fff; border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 11px; color: var(--muted);
}
.toast .acts .lbl { font-size: 14px; }
.toast .acts b { color: var(--green); font-size: 13px; }
.toast .acts i { grid-column: 2 / -1; font-style: normal; font-size: 11px; color: var(--muted); }
.toast .wait { height: 3px; margin-top: 10px; background: #eceff3; border-radius: 2px; overflow: hidden; }
.toast .wait > i { display: block; height: 100%; background: var(--amber); transform-origin: left; }
body.dragging #toasts { pointer-events: none; }
.freeze {
  display: none; align-items: center; gap: 4px;
  background: #e3f1ff; color: var(--loop);
  border-radius: 10px; padding: 2px 9px;
  font-size: 12px; font-weight: 700;
}
.freeze.on { display: inline-flex; }
body.frozen .card .ttl > i { background: var(--loop); }
body.frozen .card .due { background: #e3f1ff; color: var(--loop); }
.toast.angry .chan { color: var(--red); }
@keyframes slide-in { from { opacity: 0; transform: translateX(120%); } }
@keyframes slide-out { to { opacity: 0; transform: translateX(120%) scale(.95); } }

/* ── модалка ────────────────────────────────────── */
#overlay { position: fixed; inset: 0; background: rgba(10,12,18,.72); display: flex; align-items: center; justify-content: center; z-index: 100; }
#overlay.hidden { display: none; }
.modal { background: #fff; border-radius: 12px; padding: 26px 30px; max-width: 470px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.5); }
.modal h1 { margin: 0 0 6px; font-size: 24px; }
.modal p { color: #4d5462; margin: 8px 0; text-align: left; font-size: 13.5px; }
.modal .kpi { font-size: 44px; font-weight: 700; margin-top: 8px; }
.modal .grade { color: var(--accent); font-size: 17px; margin-bottom: 12px; }
.modal kbd { background: var(--pill); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-size: 12px; font-family: inherit; }
button {
  margin-top: 14px; background: var(--accent); color: #fff; border: 0;
  border-radius: 7px; padding: 11px 20px; font: inherit; font-weight: 600; cursor: pointer;
}
button:hover { filter: brightness(1.08); }

body.blocked .columns { pointer-events: none; filter: grayscale(.5) brightness(.85); }

.sheet { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(10,12,18,.55); }
.sheet.hidden { display: none; }

.zoom-win { width: min(440px, 92vw); background: #20242e; color: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.6); }
.zoom-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #2b303c; font-size: 13px; }
.zoom-bar .zz { font-weight: 700; color: #4aa3ff; }
.zoom-body { padding: 18px 14px 14px; }
.zoom-body .tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.zoom-body .tiles span {
  aspect-ratio: 4 / 3; border-radius: 8px; background: #2b303c;
  display: grid; place-items: center; font-size: 26px;
}
.zoom-body .tiles .you { outline: 2px solid #4aa3ff; }
.zoom-note { margin-top: 12px; color: #aeb6c6; font-size: 13px; text-align: center; }
.zoom-acts { padding: 0 14px 16px; display: flex; justify-content: center; }
.zoom-acts .drop { margin: 0; background: var(--red); min-width: 220px; }
.zoom-acts .drop:disabled { background: #4a4f5c; color: #aeb6c6; cursor: not-allowed; }

.oops-win { width: min(420px, 92vw); background: #fff; border-radius: 12px; padding: 26px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.5); }
.oops-code { font-size: 54px; font-weight: 800; color: var(--red); line-height: 1; }
.oops-text { margin-top: 8px; color: #4d5462; }
.oops-bar { margin-top: 16px; height: 4px; background: var(--pill); border-radius: 2px; overflow: hidden; }
.oops-bar > i { display: block; height: 100%; width: 40%; background: var(--red); animation: slide 1s linear infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

#qflash {
  position: fixed; inset: 0; z-index: 75; pointer-events: none;
  display: grid; place-items: center;
  font-size: 140px; font-weight: 800; color: rgba(255,255,255,.9);
  text-shadow: 0 8px 40px rgba(0,0,0,.6);
  opacity: 0;
}
#qflash.on { animation: qflash 1.4s ease-out; }
@keyframes qflash {
  0% { opacity: 0; transform: scale(.7); }
  25% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.15); }
}

#float { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.fx { position: absolute; font-weight: 700; color: var(--green); text-shadow: 0 1px 3px rgba(0,0,0,.4); animation: fly .8s ease-out forwards; }
.fx.minus { color: #ff6b6e; }
@keyframes fly { to { transform: translateY(-40px); opacity: 0; } }

@media (max-width: 760px) {
  .topbar { grid-template-columns: auto auto; row-gap: 4px; }
  .center { grid-column: 1 / -1; grid-row: 2; }
  .board-name, .toolbar .btn:nth-child(n+3) { display: none; }
  .kpi-box > b { font-size: 32px; }
  #toasts { bottom: 10px; right: 8px; }
  .toast .text { font-size: 15px; }
  .toast .face { width: 31px; height: 31px; font-size: 18px; }
  .toast .head { font-size: 12px; }
  .columns { grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 4px; }
  .year { min-width: 130px; }
  #qflash { font-size: 80px; }
  main { padding: 6px; }
}
