/* Тасковій — стилі */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --canvas: #F2F3F7;
  --surface: #FFFFFF;
  --sidebar: #181920;
  --sidebar-soft: #23252F;
  --sidebar-line: #2C2E39;
  --ink: #15171D;
  --muted: #6A6F7E;
  --faint: #9CA1AE;
  --line: #E6E8EE;
  --primary: #5B5BD6;
  --primary-soft: #ECECFB;
  --col-bg: #EBEDF2;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Space Grotesk', var(--font);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--canvas);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfd2db; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
.hidden { display: none !important; }

/* ---------- Auth ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(1200px 600px at 70% -10%, #e9e9fb 0%, var(--canvas) 55%);
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(20,23,29,.10);
  overflow: hidden;
}
.auth-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 24px 28px 0;
}
.auth-logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px;
}
.auth-brand h1 { font-family: var(--display); font-size: 20px; }
.auth-body { padding: 8px 28px 28px; }
.auth-sub { color: var(--muted); margin: 6px 0 22px; }
.tabs { display: flex; gap: 4px; background: var(--canvas); padding: 4px; border-radius: 12px; margin-bottom: 22px; }
.tab {
  flex: 1; padding: 9px 0; border-radius: 9px; font-weight: 600; color: var(--muted); font-size: 13px;
}
.tab.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(20,23,29,.08); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 10px;
  padding: 0 12px; background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.btn-primary {
  width: 100%; height: 44px; border-radius: 11px;
  background: var(--primary); color: #fff; font-weight: 600; font-size: 14px;
  transition: filter .15s, transform .05s;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.auth-error {
  background: #FDECEC; color: #C5333A; border-radius: 10px;
  padding: 10px 12px; font-size: 13px; margin-bottom: 14px;
}

/* ---------- App shell ---------- */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 256px; flex-shrink: 0; background: var(--sidebar); color: #E7E8EE;
  display: flex; flex-direction: column;
}
.sb-brand { height: 60px; display: flex; align-items: center; gap: 10px; padding: 0 18px; border-bottom: 1px solid var(--sidebar-line); }
.sb-logo { width: 28px; height: 28px; border-radius: 9px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.sb-brand span { font-family: var(--display); font-weight: 700; font-size: 15px; color: #fff; }
.sb-section { display: flex; align-items: center; justify-content: space-between; padding: 16px 14px 8px; }
.sb-section span { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.sb-add { width: 24px; height: 24px; border-radius: 7px; color: var(--faint); display: flex; align-items: center; justify-content: center; }
.sb-add:hover { background: var(--sidebar-soft); }
.sb-projects { flex: 1; overflow-y: auto; padding: 0 8px; }
.proj {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px; font-weight: 500; text-align: left; color: #B9BCC7;
  margin-bottom: 2px;
}
.proj:hover { background: var(--sidebar-soft); }
.proj.active { background: var(--sidebar-soft); color: #fff; }
.proj .dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.proj .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj .cnt { font-size: 12px; color: var(--faint); }
.sb-footer { padding: 14px; border-top: 1px solid var(--sidebar-line); display: flex; align-items: center; justify-content: space-between; }
.sb-user { display: flex; align-items: center; gap: 9px; min-width: 0; }
.sb-user .nm { font-size: 13px; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user .em { font-size: 11px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { width: 30px; height: 30px; border-radius: 8px; color: var(--faint); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.icon-btn:hover { background: var(--sidebar-soft); color: #fff; }

.avatar { border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; color: #fff; flex-shrink: 0; }

/* ---------- Main ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { padding: 16px 24px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar-row { display: flex; align-items: center; gap: 12px; }
.topbar h2 { font-family: var(--display); font-size: 20px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .pdot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.prog { font-size: 12px; color: var(--muted); }
.controls { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 8px; background: var(--canvas); border-radius: 10px; padding: 0 10px; height: 38px; flex: 1; min-width: 180px; max-width: 320px; }
.search input { background: transparent; border: none; width: 100%; }
.ctl-btn { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 500; }
.ctl-btn.on { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.viewtog { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.viewtog button { height: 38px; padding: 0 12px; display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; background: var(--surface); }
.viewtog button.on { background: var(--primary-soft); color: var(--primary); }
.filters { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.sel { position: relative; display: inline-flex; align-items: center; }
.sel select { appearance: none; -webkit-appearance: none; border: 1px solid var(--line); border-radius: 9px; height: 36px; padding: 0 30px 0 12px; background: var(--surface); font-weight: 500; }
.sel::after { content: ''; position: absolute; right: 12px; width: 7px; height: 7px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(45deg) translateY(-2px); pointer-events: none; }
.lbl { font-size: 12px; color: var(--muted); margin-right: 4px; }
.link { color: var(--primary); font-weight: 600; font-size: 13px; }

/* ---------- Board ---------- */
.board-scroll { flex: 1; overflow-x: auto; overflow-y: hidden; padding: 16px 24px; }
.board { display: flex; gap: 16px; height: 100%; min-width: max-content; }
.col { width: 290px; flex-shrink: 0; background: var(--col-bg); border-radius: 13px; display: flex; flex-direction: column; max-height: 100%; transition: background .15s; }
.col.over { background: var(--primary-soft); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.col-head .dot { width: 8px; height: 8px; border-radius: 50%; }
.col-head .t { font-weight: 600; }
.col-head .c { font-size: 12px; font-weight: 500; color: var(--muted); background: #fff; padding: 0 6px; border-radius: 5px; }
.col-body { flex: 1; overflow-y: auto; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 8px; }
.add-task { display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-radius: 9px; color: var(--muted); font-weight: 500; width: 100%; }
.add-task:hover { background: #fff; }

.card { background: var(--surface); border-radius: 10px; padding: 11px 12px 11px 14px; cursor: pointer; position: relative; box-shadow: 0 1px 2px rgba(20,23,29,.06); transition: box-shadow .15s, transform .1s; }
.card:hover { box-shadow: 0 6px 20px rgba(20,23,29,.10); }
.card.dragging { opacity: .4; }
.card .stripe { position: absolute; left: 0; top: 11px; bottom: 11px; width: 3px; border-radius: 0 3px 3px 0; }
.card .ttl { font-weight: 500; line-height: 1.35; }
.card.done .ttl { text-decoration: line-through; opacity: .55; }
.card .meta { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; }
.mini { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; color: var(--muted); }
.spacer { flex: 1; }

/* ---------- List ---------- */
.list-scroll { flex: 1; overflow-y: auto; padding: 16px 24px; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.list-group-head { display: flex; align-items: center; gap: 8px; padding: 9px 16px; background: var(--canvas); border-bottom: 1px solid var(--line); }
.list-group-head .dot { width: 8px; height: 8px; border-radius: 50%; }
.list-group-head .t { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.list-group-head .c { font-size: 12px; color: var(--faint); }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.list-row:hover { background: var(--canvas); }
.list-row .ttl { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row.done .ttl { text-decoration: line-through; opacity: .55; }
.list-row .due { font-size: 11px; font-weight: 500; width: 92px; text-align: right; }
.empty { padding: 60px 24px; text-align: center; color: var(--muted); }

/* ---------- Modal / drawer ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20,23,29,.42); z-index: 50; display: flex; }
.overlay.right { justify-content: flex-end; }
.overlay.center { align-items: center; justify-content: center; padding: 24px; }
.drawer { height: 100%; width: 100%; max-width: 460px; background: var(--surface); display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(0,0,0,.2); animation: slideIn .2s ease; }
@keyframes slideIn { from { transform: translateX(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head { height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid var(--line); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 20px; }
.dtitle { width: 100%; font-family: var(--display); font-size: 19px; font-weight: 700; border: none; resize: none; line-height: 1.3; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.f-lbl { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--faint); margin-bottom: 6px; }
.f-input, .drawer-body select { width: 100%; height: 36px; border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; background: var(--surface); }
.drawer-body select { appearance: none; -webkit-appearance: none; padding-right: 28px; font-weight: 500; }
.f-area { width: 100%; min-height: 92px; border: 1px solid var(--line); border-radius: 9px; padding: 10px; resize: vertical; line-height: 1.5; }
.sub-row { display: flex; align-items: center; gap: 8px; padding: 5px 4px; border-radius: 8px; }
.sub-row:hover { background: var(--canvas); }
.sub-row .stxt { flex: 1; }
.sub-row.done .stxt { text-decoration: line-through; opacity: .55; }
.sub-row .del { opacity: 0; color: var(--faint); }
.sub-row:hover .del { opacity: 1; }
.sub-add { display: flex; align-items: center; gap: 8px; margin-top: 4px; padding: 0 4px; }
.sub-add input { flex: 1; border: none; background: transparent; }
.check { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--faint); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.check.on { background: #22A565; border-color: #22A565; color: #fff; }

.dialog { background: var(--surface); border-radius: 16px; width: 100%; max-width: 380px; padding: 22px; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.dialog h3 { font-family: var(--display); font-size: 17px; margin-bottom: 14px; }
.dialog .row { display: flex; gap: 8px; margin-top: 16px; }
.btn-ghost { flex: 1; height: 40px; border-radius: 10px; border: 1px solid var(--line); font-weight: 600; color: var(--muted); }
.dialog .btn-primary { flex: 1; height: 40px; }

.burger { display: none; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--sidebar); color: #fff; padding: 11px 18px; border-radius: 11px; font-size: 13px; font-weight: 500; z-index: 80; box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: slideIn .2s; }

/* ---------- Card thumbnail ---------- */
.card-thumb { position: relative; margin: -11px -12px 10px -14px; border-radius: 10px 10px 0 0; overflow: hidden; background: #e9ebf0; }
.card-thumb img { display: block; width: 100%; height: 124px; object-fit: cover; }
.thumb-more { position: absolute; right: 6px; bottom: 6px; background: rgba(20,23,29,.74); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; }

/* ---------- Rich-text editor ---------- */
.rte { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.rte:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.rte-bar { display: flex; align-items: center; gap: 2px; padding: 5px 6px; border-bottom: 1px solid var(--line); background: var(--canvas); flex-wrap: wrap; }
.rte-btn { width: 30px; height: 28px; border-radius: 7px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.rte-btn:hover { background: #fff; color: var(--ink); }
.rte-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.rte-editor { min-height: 96px; max-height: 320px; overflow-y: auto; padding: 10px 12px; line-height: 1.55; }
.rte-editor:empty:before { content: attr(data-ph); color: var(--faint); }
.rte-editor ul, .rte-editor ol { margin: 4px 0 4px 22px; }
.rte-editor li { margin: 2px 0; }
.rte-editor a { color: var(--primary); }
.rte-editor h3 { font-size: 15px; margin: 6px 0; }
.rte-editor blockquote { border-left: 3px solid var(--line); margin: 6px 0; padding-left: 10px; color: var(--muted); }
.rte-editor code { background: var(--canvas); padding: 1px 5px; border-radius: 5px; font-family: ui-monospace, monospace; font-size: 13px; }

/* ---------- Attachments ---------- */
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.att { position: relative; aspect-ratio: 1 / 1; border-radius: 9px; overflow: hidden; background: var(--canvas); border: 1px solid var(--line); }
.att img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.att-del { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(20,23,29,.62); color: #fff; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s; }
.att:hover .att-del { opacity: 1; }
.att-add { aspect-ratio: 1 / 1; border: 1.5px dashed var(--line); border-radius: 9px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 500; }
.att-add:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.att-hint { font-size: 11px; color: var(--faint); margin-top: 8px; }

/* ---------- Drag-drop & lightbox ---------- */
.drawer { position: relative; }
.drawer.dropping { box-shadow: inset 0 0 0 3px var(--primary); }
.drawer.dropping::after { content: 'Відпустіть, щоб завантажити'; position: absolute; inset: 0; background: rgba(91,91,214,.10); color: var(--primary); font-weight: 700; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 5; }
.lightbox { position: fixed; inset: 0; background: rgba(10,11,15,.86); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 32px; cursor: zoom-out; animation: slideIn .15s; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lb-close { position: fixed; top: 18px; right: 20px; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.14); display: flex; align-items: center; justify-content: center; }
.lb-close:hover { background: rgba(255,255,255,.26); }

/* ---------- Archive ---------- */
.col-arch { width: 24px; height: 24px; border-radius: 6px; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.col-arch:hover { background: #fff; color: var(--ink); }
.arch-head { font-size: 13px; color: var(--muted); margin-bottom: 12px; line-height: 1.5; }

/* ---------- Scrum ---------- */
.card-top { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.chip.type { font-weight: 600; }
.pts { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 6px; background: var(--sidebar); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.pts.empty { background: var(--canvas); color: var(--faint); }

.board-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.sprint-head { display: flex; align-items: flex-start; gap: 16px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--surface); }
.sprint-head-main { flex: 1; min-width: 0; }
.sprint-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sprint-badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; display: inline-flex; align-items: center; gap: 5px; }
.sprint-sel select { height: 32px; }
.sprint-goal { margin-top: 8px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.sprint-prog { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.sprint-prog .bar { flex: 1; max-width: 340px; height: 8px; border-radius: 6px; background: var(--col-bg); overflow: hidden; }
.sprint-prog .bar span { display: block; height: 100%; background: #22A565; border-radius: 6px; transition: width .4s; }
.burndown { flex-shrink: 0; }
.btn-primary.sm, .ctl-btn.sm { height: 32px; width: auto; padding: 0 12px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; }

.bl-wrap { max-width: 920px; }
.bl-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.bl-top h3 { font-family: var(--display); font-size: 18px; }
.bl-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; margin-bottom: 14px; overflow: hidden; }
.bl-panel.completed { opacity: .72; }
.bl-panel-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--canvas); flex-wrap: wrap; }
.bl-sp-name { font-weight: 700; font-family: var(--display); }
.bl-goal { padding: 9px 14px 0; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.bl-drop { padding: 8px; min-height: 20px; transition: background .15s; }
.bl-drop.over { background: var(--primary-soft); }
.bl-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.bl-row:hover { background: var(--canvas); }
.bl-row.dragging { opacity: .4; }
.bl-row.done .bl-ttl { text-decoration: line-through; opacity: .55; }
.bl-row .grip { cursor: grab; display: flex; }
.bl-row .pts { margin-left: 0; }
.bl-ttl { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-empty { padding: 14px; text-align: center; color: var(--faint); font-size: 13px; border: 1.5px dashed var(--line); border-radius: 9px; margin: 2px; }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 60; transform: translateX(-100%); transition: transform .22s ease; }
  .sidebar.open { transform: none; }
  .burger { display: flex; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 55; }
  .topbar { padding: 14px 16px 10px; }
  .board-scroll, .list-scroll { padding: 14px 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .drawer { max-width: 100%; }
}
