:root {
  --bg: #f4f5fb;
  --surface: #ffffff;
  --primary: #6c5ce7;
  --primary-2: #5a48dc;
  --primary-soft: #eeeaff;
  --accent: #5cb8ff;
  --accent-soft: #eef6ff;
  --ink: #1e2036;
  --muted: #8a90a8;
  --line: #eceef7;
  --success: #2fbf71;
  --danger: #ef6b7a;
  --warning: #f5a623;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 4px 16px rgba(30, 32, 70, 0.06);
  --shadow-md: 0 14px 40px rgba(30, 32, 70, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

body.light {
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 8% -8%, rgba(108, 92, 231, 0.10), transparent 60%),
    radial-gradient(700px 480px at 100% 0%, rgba(92, 184, 255, 0.12), transparent 60%),
    var(--bg);
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.spacer { flex: 1; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 13px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .16s;
  color: #fff;
  text-decoration: none;
}
.btn-primary { background: linear-gradient(135deg, #7c6cf0, #5a48dc); box-shadow: 0 8px 20px rgba(108, 92, 231, .28); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(108, 92, 231, .36); }
.btn-success { background: var(--success); }
.btn-success:hover { background: #28a866; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #e05566; }
.btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { background: #f7f7fc; }
.btn-block { width: 100%; }
.btn.round { width: 42px; height: 42px; padding: 0; border-radius: 50%; }
.icon-btn { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 18px; padding: 6px; border-radius: 9px; }
.icon-btn:hover { color: var(--ink); background: #f2f2f8; }
.link-btn { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 9px; }
.link-btn:hover { background: #f2f2f8; color: var(--ink); }

/* ---------------- Login ---------------- */
.full-center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.card { background: var(--surface); border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-md); }
.login-card { width: 100%; max-width: 400px; }
.login-logo {
  width: 58px; height: 58px; border-radius: 16px; margin: 0 auto 16px;
  background: linear-gradient(135deg, #7c6cf0, #5cb8ff);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px rgba(108, 92, 231, .3);
}
.login-logo span { color: #fff; font-weight: 800; font-size: 22px; }
.login-card h1 { font-size: 24px; margin: 0; text-align: center; }
.login-card p { margin: 4px 0 20px; text-align: center; }
.hint { margin-top: 16px; font-size: 12px; color: var(--muted); background: #f7f7fc; border-radius: 12px; padding: 10px 12px; line-height: 1.6; }
.hint code { font-family: ui-monospace, monospace; background: #fff; padding: 1px 5px; border-radius: 5px; border: 1px solid var(--line); }

/* ---------------- Forms ---------------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin: 14px 0 6px; }
input, textarea, select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 13px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108, 92, 231, .15); }
textarea { resize: vertical; }

/* ---------------- Shell / Sidebar ---------------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 256px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, #7c6cf0, #5cb8ff);
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 18px;
}
.brand-title { font-size: 15px; font-weight: 700; line-height: 1.2; }
.brand-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.side-nav { padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 13px;
  border: none; background: transparent; cursor: pointer; font-size: 14px; font-weight: 600;
  color: var(--muted); text-align: left; transition: all .15s; width: 100%;
}
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item:hover { background: #f5f5fb; color: var(--ink); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); }

.side-footer { padding: 14px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.side-user { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.side-user-text { min-width: 0; }
.side-user-text #user-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-text #user-role { font-size: 11px; }
.side-logout {
  width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: #fff;
  color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.side-logout:hover { color: var(--danger); border-color: #ffd9dd; background: #fff5f6; }
.side-logout svg { width: 18px; height: 18px; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0;
}

/* ---------------- Content ---------------- */
.content { flex: 1; min-width: 0; padding: 28px 32px; }
.view { max-width: 1400px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 26px; font-weight: 800; margin: 0; }
.page-head p { margin: 4px 0 0; }
.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.search { position: relative; }
.search input {
  background: #fff; border: 1px solid var(--line); color: var(--ink);
  padding: 11px 34px 11px 14px; border-radius: 13px; min-width: 220px;
}
.search input::placeholder { color: var(--muted); }
.search-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; }

.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.view-tab {
  padding: 9px 20px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer;
  color: var(--muted); background: #fff; border: 1px solid var(--line);
}
.view-tab:hover { color: var(--ink); }
.view-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------------- Stats ---------------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm);
}
.stat-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.stat-value { color: var(--ink); font-size: 28px; font-weight: 800; margin-top: 6px; }

/* ---------------- Kanban ---------------- */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 14px; }
.kanban-col { flex: 1; min-width: 220px; display: flex; flex-direction: column; }
.kanban-head {
  border-radius: 13px; padding: 10px 16px; display: flex; justify-content: space-between;
  font-weight: 700; font-size: 13px; box-shadow: 0 6px 16px rgba(30,32,70,.14);
}
.kanban-body { flex: 1; padding: 10px 0; display: flex; flex-direction: column; gap: 10px; min-height: 300px; }

.task-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 15px;
  cursor: pointer; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s;
}
.task-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.task-card h4 { margin: 0 0 8px; font-size: 14px; line-height: 1.4; color: var(--ink); }
.tc-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding: 3px 0; }
.tc-row span { color: var(--muted); }
.tc-row b { color: var(--ink); font-weight: 600; text-align: right; }
.tc-author { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.tc-author .avatar { width: 20px; height: 20px; font-size: 9px; }
.overdue { color: var(--danger) !important; }
.chip { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; margin-top: 10px; }
.chip-low { background: #f1f2f8; color: #8a90a8; }
.chip-medium { background: #fff5e1; color: #b07600; }
.chip-high { background: #ffe9ec; color: #d6455a; }
.tc-footer { margin-top: 10px; padding-top: 9px; border-top: 1px solid #f2f3f8; display: flex; justify-content: flex-end; font-size: 11px; color: var(--muted); }

/* ---------------- List view ---------------- */
.list-wrap { background: #fff; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-md); }
.list-wrap table { width: 100%; border-collapse: collapse; font-size: 14px; }
.list-wrap th { text-align: left; padding: 13px 16px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); }
.list-wrap td { padding: 13px 16px; border-bottom: 1px solid #f3f4f9; }
.list-wrap tr:last-child td { border-bottom: none; }
.list-wrap tbody tr:hover td { background: #f8f8fd; cursor: pointer; }

/* ---------------- Badge ---------------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge .dot { width: 8px; height: 8px; border-radius: 50%; }

/* ---------------- Modal ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(30, 32, 60, 0.34);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  animation: modalFade 0.22s ease-out;
}
.modal-card { width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; }
.modal-card.wide { max-width: 780px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.modal-head h3 { margin: 0; font-size: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
section { margin-bottom: 20px; }
section h4 { font-size: 15px; margin: 0 0 6px; }
section h5 { font-size: 13px; margin: 16px 0 6px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------------- Task modal ---------------- */
.task-modal-content {
  background: rgba(255, 255, 255, 0.58);
  -webkit-backdrop-filter: blur(32px) saturate(1.5);
  backdrop-filter: blur(32px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.75);
  width: min(1180px, 96vw);
  height: min(860px, 94vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 26px;
  box-shadow: 0 40px 90px rgba(20, 22, 60, 0.3);
  animation: taskOpen 0.26s cubic-bezier(0.2, 0.9, 0.25, 1) backwards;
  transform-origin: center;
}
@media (min-width: 1024px) {
  .task-modal-content { flex-direction: row; }
  .task-left { width: var(--split, 50%); }
  .task-right { width: calc(100% - var(--split, 50%) - 6px); }
  #task-divider { display: block; }
}
@media (max-width: 1023px) {
  #task-modal { padding: 0; }
  .task-modal-content { width: 100%; height: 100%; border-radius: 0; border: none; }
}
.task-left { background: rgba(255, 255, 255, 0.5); display: flex; flex-direction: column; min-width: 0; }
.task-head { display: flex; align-items: center; gap: 12px; padding: 13px 22px; border-bottom: 1px solid rgba(255, 255, 255, 0.5); background: rgba(255, 255, 255, 0.6); flex-shrink: 0; }
.task-body { flex: 1; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.task-body h3 { margin: 0; font-size: 22px; }
.block { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.block-title { padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 700; }
.block-title-row { display: flex; justify-content: space-between; align-items: center; }
.fields { padding: 0; }
.field { display: flex; justify-content: space-between; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.field:last-child { border-bottom: none; }
.field span { color: var(--muted); }
.divide > div { border-bottom: 1px solid var(--line); }
.divide > div:last-child { border-bottom: none; }
.total-row { display: flex; justify-content: space-between; padding: 13px 16px; background: #fafaff; border-top: 1px solid var(--line); font-size: 14px; }
.task-actions-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 22px; border-top: 1px solid rgba(255, 255, 255, 0.5); background: rgba(255, 255, 255, 0.6); min-height: 72px; flex-shrink: 0; }
#task-actions { display: flex; gap: 8px; flex-wrap: wrap; }

#task-divider { display: none; width: 6px; background: var(--line); cursor: col-resize; flex-shrink: 0; }
#task-divider:hover { background: var(--primary); }

.task-right { background: rgba(243, 246, 253, 0.45); display: flex; flex-direction: column; min-width: 0; }
.comments { flex: 1; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.comment { display: flex; gap: 10px; max-width: 85%; }
.comment.own { align-self: flex-end; flex-direction: row-reverse; }
.comment .avatar { flex-shrink: 0; }
.comment .bubble { background: #fff; padding: 10px 14px; border-radius: 15px 15px 15px 5px; font-size: 14px; box-shadow: 0 2px 6px rgba(30,32,70,.07); }
.comment.own .bubble { background: var(--primary); color: #fff; border-radius: 15px 15px 5px 15px; }
.comment .meta { font-size: 11px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.comment.own .meta { justify-content: flex-end; }
.comment-input { padding: 13px; border-top: 1px solid rgba(255, 255, 255, 0.5); background: rgba(255, 255, 255, 0.6); }
.comment-input form { display: flex; gap: 8px; }
.comment-input input { flex: 1; border-radius: 999px; background: #f6f7fb; border: 1px solid var(--line); }

/* ---------------- Priority segmented ---------------- */
.priority-seg { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.priority-seg button { padding: 11px; border-radius: 13px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink); }
.priority-seg button[data-v="low"].active { background: #eef0f5; border-color: #c7cad6; }
.priority-seg button[data-v="medium"].active { background: #fff3d6; border-color: #f0c36d; color: #a06a00; }
.priority-seg button[data-v="high"].active { background: #ffe7ea; border-color: #f5a0ab; color: #c92a3f; }

/* ---------------- Settings ---------------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.card-title { font-size: 16px; font-weight: 700; margin: 0 0 14px; }
.profile-info { text-align: center; margin-bottom: 16px; }
.profile-info .avatar { width: 68px; height: 68px; font-size: 24px; margin: 0 auto 8px; }
.profile-info h4 { margin: 0; font-size: 17px; }
.profile-info p { margin: 2px 0; color: var(--muted); font-size: 13px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; cursor: pointer; margin: 12px 0 4px; font-size: 14px; font-weight: 600; }
.switch-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch { width: 46px; height: 26px; background: #d4d7e2; border-radius: 999px; position: relative; transition: .2s; display: inline-block; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch-row input:checked + .switch { background: var(--primary); }
.switch-row input:checked + .switch::after { transform: translateX(20px); }
.check-block { margin: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.check-row { display: flex; align-items: center; gap: 9px; font-size: 14px; margin: 0; cursor: pointer; }
.check-row input { width: auto; accent-color: var(--primary); }

/* ---------------- Placeholder ---------------- */
.placeholder {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 60px 30px; text-align: center; box-shadow: var(--shadow-sm); max-width: 640px;
}
.placeholder-icon { font-size: 44px; margin-bottom: 12px; }
.placeholder h3 { margin: 0 0 8px; font-size: 18px; }
.placeholder p { margin: 0 auto; max-width: 460px; line-height: 1.6; }

/* ---------------- Toast ---------------- */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast { color: #fff; padding: 13px 17px; border-radius: 14px; min-width: 260px; max-width: 380px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-md); animation: fadeUp .25s ease-out; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--primary); }
@keyframes fadeUp { from { transform: translateY(6px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; padding: 8px 12px; overflow-x: auto; }
  .side-brand { padding: 0 8px 0 0; }
  .brand-sub { display: none; }
  .side-nav { flex-direction: row; padding: 0; gap: 4px; }
  .nav-item { width: auto; padding: 9px 12px; white-space: nowrap; }
  .nav-item svg { width: 18px; height: 18px; }
  .side-footer { border-top: none; padding: 0 0 0 8px; }
  .side-user-text { display: none; }
  .content { padding: 18px 14px; }
  .stats { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 21px; }
}

/* ============ Анимации, градиенты, ликвид-гласс ============ */
body.light { position: relative; }
body.light::before,
body.light::after {
  content: '';
  position: fixed;
  width: 58vmax;
  height: 58vmax;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
  z-index: 0;
}
body.light::before {
  top: -20vmax; left: -16vmax;
  background: radial-gradient(circle at 40% 40%, rgba(124, 108, 240, 0.30), rgba(124, 108, 240, 0) 62%);
  animation: blobFloat 24s ease-in-out infinite alternate;
}
body.light::after {
  bottom: -26vmax; right: -18vmax;
  background: radial-gradient(circle at 60% 40%, rgba(92, 184, 255, 0.32), rgba(92, 184, 255, 0) 62%);
  animation: blobFloat 32s ease-in-out infinite alternate-reverse;
}
@keyframes blobFloat {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(5vmax, 4vmax, 0) scale(1.14); }
}

/* Ликвид-гласс */
.sidebar {
  background: rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(22px) saturate(1.6);
  backdrop-filter: blur(22px) saturate(1.6);
  border-right: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 40px rgba(30, 32, 70, 0.06);
}
.view-tab,
.search input,
.btn-ghost {
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.view-tab { background: rgba(255, 255, 255, 0.6); border-color: rgba(255, 255, 255, 0.75); }
.search input { background: rgba(255, 255, 255, 0.7); border-color: rgba(255, 255, 255, 0.8); }
.btn-ghost { background: rgba(255, 255, 255, 0.6); border-color: rgba(255, 255, 255, 0.75); }
.modal .card {
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(26px);
  backdrop-filter: blur(26px);
}
.full-center .card { animation: cardIn 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; }

/* Градиентные плитки */
.stat-card {
  position: relative;
  overflow: hidden;
  color: #fff;
  border: none;
  box-shadow: 0 14px 30px rgba(30, 32, 70, 0.18);
  animation: cardIn 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 18px 36px rgba(30, 32, 70, 0.24); }
.stat-card .stat-label { color: rgba(255, 255, 255, 0.85); }
.stat-card .stat-value { color: #fff; }
.stat-card::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 10% 0%, rgba(255, 255, 255, 0.28), transparent 55%);
  pointer-events: none;
}
.stat-card::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: -90%; width: 55%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  transform: skewX(-18deg);
  animation: sheen 5.5s ease-in-out infinite;
}
@keyframes sheen {
  0% { left: -90%; }
  45%, 100% { left: 150%; }
}

/* Появление карточек и разделов */
.task-card { animation: cardIn 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; }
.view { animation: viewIn 0.3s ease-out; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* Плавный градиент на логотипах */
.brand-mark,
.login-logo { background-size: 180% 180%; animation: gradFlow 9s ease-in-out infinite; }
@keyframes gradFlow {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Открытие карточки задачи и подложки */
@keyframes taskOpen {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes modalFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============ Карточка задачи: bottom-sheet, закрытие, «парящие» кнопки ============ */
.head-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.space-select {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7); color: var(--ink); font-size: 12px; font-weight: 600;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); cursor: pointer; max-width: 240px;
}

#task-modal { padding: 0; align-items: flex-end; }
.task-modal-content {
  position: relative;
  width: 100%;
  max-width: none;
  height: min(88vh, 900px);
  border-radius: 26px 26px 0 0;
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.7);
  animation: taskRise 0.34s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
@keyframes taskRise {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.task-close {
  position: absolute; top: 16px; left: 16px; z-index: 6;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: var(--muted); font-size: 16px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(30, 32, 70, 0.2);
  transition: all 0.15s ease;
}
.task-close:hover { color: #fff; background: var(--primary); border-color: var(--primary); transform: scale(1.05); }

.task-head { padding-left: 60px; }

/* Кнопки «парят» над контентом без подложки */
.task-actions-row {
  background: transparent;
  border-top: none;
  justify-content: flex-end;
  padding: 6px 22px 16px;
}
#task-actions { margin-right: auto; }
.task-actions-row .btn {
  box-shadow: 0 10px 24px rgba(30, 32, 70, 0.18);
}

@media (max-width: 1023px) {
  .task-modal-content { overflow-y: auto; height: 94vh; }
  .task-body, .comments { overflow: visible; }
}

/* Отступы карточки задачи по 10% с каждой стороны + рабочая зона ползунка */
#task-modal { padding: 0 10vw; }
.task-modal-content { width: 100%; }

#task-divider {
  display: none;
  width: 14px;
  background: transparent;
  cursor: col-resize;
  touch-action: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
}
#task-divider::before {
  content: '';
  display: block;
  width: 3px;
  height: 60%;
  max-height: 150px;
  border-radius: 999px;
  background: rgba(30, 32, 70, 0.12);
  transition: background .15s, transform .15s;
}
#task-divider:hover::before,
#task-divider.dragging::before { background: var(--primary); transform: scaleX(1.4); }
body.resizing { user-select: none; cursor: col-resize; }

@media (min-width: 1024px) {
  #task-divider { display: flex; }
  .task-right { width: calc(100% - var(--split, 50%) - 14px); }
}

/* Равные отступы сверху/слева/справа 5% + закрытие «уезжанием» вниз */
#task-modal { padding: 5vw 5vw 0; }
#task-modal.closing .task-modal-content {
  animation: taskExit 0.3s cubic-bezier(0.5, 0, 0.7, 0.25) forwards;
  pointer-events: none;
}
@keyframes taskExit {
  to { transform: translateY(120%); opacity: 0; }
}

/* Верхний отступ меньше + кнопка закрытия стоит на верхней границе карточки */
#task-modal { padding: 24px 5vw 0; }
.task-close { top: 24px; left: 5vw; }
