:root {
  --bg: #0f1115;
  --card: #151a21;
  --text: #e6eaf0;
  --muted: #8b97a7;
  --accent: #3b82f6;
  --border: #232b36;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #0b0f14;
  color: white;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
}

.brand { font-weight: 700; }

.brand-home {
  color: inherit;
  text-decoration: none;
  position: relative;
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-block;
}

.brand-home:hover {
  color: #e2e8f0;
}

.brand-outline {
  position: absolute;
  inset: -3px -4px;
  width: calc(100% + 8px);
  height: calc(100% + 6px);
  pointer-events: none;
}

.brand-outline rect {
  fill: none;
  stroke: rgba(59, 130, 246, 0.95);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 4 8.5;
  animation: dash-move 2.2s linear infinite;
  filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.7));
}

.brand-text-static {
  display: inline-block;
  font-weight: 700;
}

@keyframes dash-move {
  0% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -12.5; }
}

.burger {
  margin-right: 10px;
  background: transparent;
  border: 1px solid #2a3342;
  color: #cbd5e1;
  border-radius: 6px;
  width: 32px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.burger:hover {
  border-color: #60a5fa;
  color: #e2e8f0;
}

.brand-link {
  margin-left: 12px;
  font-weight: 600;
  font-size: 13px;
  color: #7dd3fc;
  text-decoration: none;
  border: 1px solid #2a3342;
  padding: 4px 8px;
  border-radius: 6px;
}

.brand-link:hover {
  color: #e0f2fe;
  border-color: #60a5fa;
}

.container {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px;
}

.app-shell {
  position: relative;
  min-height: calc(100vh - 64px);
  padding-top: 64px;
}

.side-menu {
  position: fixed;
  top: 64px;
  left: 0;
  width: 260px;
  height: calc(100vh - 64px);
  background: #0c1016;
  border-right: 1px solid #1f2733;
  padding: 10px 10px;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  z-index: 20;
}

.side-menu.open {
  transform: translateX(0);
}

.side-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.side-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: calc(100vh - 64px - 20px - 28px);
  align-items: stretch;
}

.side-list li {
  padding: 0;
  border-radius: 0;
}

.side-spacer {
  display: none;
  background: transparent;
  padding: 0;
  margin: 4px 0;
}

.tree {
  padding: 0;
  margin: 0;
}

.tree-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #121823;
  border: 1px solid #1f2733;
  color: var(--text);
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.tree-link {
  text-decoration: none;
  color: inherit;
  display: block;
  width: 100%;
}

.tree-link:hover {
  color: var(--text);
}

.tree-toggle:hover {
  border-color: #2b3546;
  background: #141b27;
}

.tree-caret {
  display: inline-flex;
  width: 14px;
  justify-content: center;
  transition: transform 0.15s ease;
}

.tree-list {
  list-style: none;
  margin: 2px 0 0 16px;
  padding: 0 0 0 10px;
  border-left: 1px solid #222c3a;
  display: grid;
  gap: 0;
}

.tree-item {
  padding: 0;
  color: var(--muted);
}

.tree-item:hover {
  color: var(--muted);
  background: transparent;
}

.tree-item .tree-link {
  padding: 2px 8px;
  border-radius: 6px;
}

.tree-item .tree-link:hover {
  color: var(--text);
  background: #121823;
}

.side-history {
  margin-top: auto;
  border: 1px solid #1f2733;
  border-radius: 8px;
}

.side-history .tree-link {
  display: block;
  padding: 4px 10px;
}

.tree.collapsed .tree-list {
  display: none;
}

.tree.collapsed .tree-caret {
  transform: rotate(-90deg);
}


.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.actions { display: flex; gap: 12px; margin-bottom: 16px; }

.form-actions {
  display: grid;
  grid-template-columns: 120px 360px;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}
.form-actions .text-link {
  justify-self: end;
}

.form-actions button {
  justify-self: end;
  max-width: 360px;
}

.text-link {
  color: #93c5fd;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.text-link:hover {
  color: #e0f2fe;
  text-decoration: underline;
}

.button, button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.button-danger {
  background: #dc2626;
}

.button-danger:hover {
  background: #b91c1c;
}

.button-muted {
  background: #475569;
}

.button-muted:hover {
  background: #334155;
}

button { font-size: 14px; }

label { display: block; margin-top: 10px; font-weight: 600; }

input, select, textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-top: 6px;
  background: #0f131a;
  color: var(--text);
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 10'%3E%3Cpath d='M2 2.2L8 8l6-5.8' fill='none' stroke='%23cfe4ff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 8px;
}

select::-ms-expand {
  display: none;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0px 1000px #0f131a inset;
  transition: background-color 9999s ease-in-out 0s;
}

.auth-form input {
  max-width: 360px;
}

.auth-wrap {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
}

.auth-card {
  width: 100%;
  max-width: 520px;
  background: transparent;
  border: none;
  padding: 0;
}

.auth-title {
  text-align: center;
  margin-bottom: 16px;
}

.page-title {
  text-align: left;
  margin-bottom: 6px;
  font-size: 18px;
}

.page-full {
  padding: 0 16px;
}

.full-width {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding: 0 16px 24px;
  transition: width 0.2s ease, margin-left 0.2s ease;
}

body.menu-open .full-width {
  width: calc(100vw - 260px);
  margin-left: calc(50% - 50vw + 260px);
}

.auth-form {
  display: grid;
  gap: 12px;
  justify-items: start;
}

.auth-row {
  display: grid;
  grid-template-columns: 120px 360px;
  align-items: center;
  gap: 12px;
}

.auth-row label {
  margin-top: 0;
  font-weight: 600;
}

.auth-row input {
  width: 360px;
  max-width: 360px;
}

.auth-row input,
.auth-form input {
  background: #0f131a;
  color: var(--text);
}

textarea { min-height: 100px; }

.list-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.list-item:last-child { border-bottom: none; }

.muted { color: var(--muted); font-size: 13px; }

.projects-head {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.projects-head h1 {
  margin: 0;
  font-size: 22px;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.project-card {
  margin-bottom: 0;
  min-height: 170px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-card h3 {
  margin: 0;
  font-size: 18px;
}

.project-card h3 a {
  color: #dbeafe;
  text-decoration: none;
}

.project-card h3 a:hover {
  text-decoration: underline;
}

.project-card p {
  margin: 0;
  color: #c6d1df;
  line-height: 1.4;
}

.project-card-footer {
  margin-top: auto;
}

.project-create {
  max-width: 860px;
}

.member-list {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.member-item {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #1f2937;
  border-radius: 8px;
  background: #0f151f;
}

.member-item input {
  margin: 0;
  width: 16px;
  height: 16px;
}

.member-item span {
  margin-top: 0;
}

.project-create-actions {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.error { color: #b91c1c; }
.success { color: #22c55e; }
.state-red { color: #ef4444; font-weight: 700; }
.state-green { color: #22c55e; font-weight: 700; }

.task-table {
  width: 100%;
  border-collapse: collapse;
}

.task-table th,
.task-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}

.task-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}

.task-table input,
.task-table select {
  width: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  margin-bottom: 10px;
  width: 100vw;
  margin-left: calc(50% - 50vw);
}

body.menu-open .page-header {
  width: calc(100vw - 260px);
  margin-left: calc(50% - 50vw + 260px);
}

.inline-add {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-add input {
  max-width: 260px;
}

.bulk-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  margin: 0;
  border: 1px solid #2b3546;
  border-radius: 10px;
  background: #0f1624;
  position: fixed;
  top: 72px;
  width: 50%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.bulk-bar.active {
  display: flex;
}

body.menu-open .bulk-bar.active {
  transform: translateX(calc(-50% + 130px));
}

body.list-scroll-page .page-header {
  position: sticky;
  top: 64px;
  z-index: 24;
  background: var(--bg);
  margin-bottom: 0;
  padding-top: 6px;
  padding-bottom: 6px;
}

body.list-scroll-page .bulk-bar {
  position: fixed;
  top: 74px;
  left: 50%;
  right: auto;
  width: min(980px, calc(100vw - 32px));
  max-width: 980px;
  transform: translateX(-50%);
  margin: 0;
  z-index: 26;
}

body.list-scroll-page .bulk-bar.active {
  display: flex;
}

body.list-scroll-page .bulk-bar.active + .bulk-bar.active {
  top: 136px;
}

body.list-scroll-page.menu-open .bulk-bar.active {
  transform: translateX(-50%);
}

body.list-scroll-page .list-scroll-area {
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding-bottom: 6px;
}

body.list-scroll-page .task-board,
body.list-scroll-page .project-board,
body.list-scroll-page .my-task-board,
body.list-scroll-page .assignee-board {
  min-height: auto;
}

.bulk-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}

.bulk-controls select {
  max-width: 220px;
}

.field-error {
  border-color: #b91c1c !important;
  box-shadow: 0 0 0 1px #b91c1c inset;
}

.field-required {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 1px #2563eb inset;
}

.bulk-count {
  font-weight: 700;
}

.task-board {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #111824;
}

.project-board {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #111824;
}

.task-header,
.task-row {
  display: grid;
  grid-template-columns: 36px 2.6fr 180px 140px 160px;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
}

.task-header {
  color: var(--muted);
  font-size: 13px;
  background: #0f1520;
  border-bottom: 1px solid var(--border);
}

.task-row {
  border-bottom: 1px solid var(--border);
  background: #141d2a;
}

.project-header,
.project-row {
  display: grid;
  grid-template-columns: 32px 36px 2fr 190px 150px 220px 180px 120px;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
}

.project-header {
  color: var(--muted);
  font-size: 13px;
  background: #0f1520;
  border-bottom: 1px solid var(--border);
}

.project-row {
  border-bottom: 1px solid #1f2a3b;
}

.project-row.empty {
  color: var(--muted);
}

.project-name-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-progress {
  width: 100%;
  height: 22px;
  border-radius: 999px;
  background: #1f2937;
  border: 1px solid #2b3546;
  overflow: hidden;
  position: relative;
}

.project-progress-fill {
  height: 100%;
  min-width: 0;
  transition: width 0.25s ease;
}

.project-progress-fill.in-progress {
  background: linear-gradient(90deg, #1d4ed8, #3b82f6);
}

.project-progress-fill.done {
  background: linear-gradient(90deg, #15803d, #22c55e);
}

.project-progress-text {
  color: #eaf2ff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
}

.client-project-head h1 {
  margin: 0 0 8px;
}

.client-progress {
  margin-top: 10px;
  max-width: 420px;
}

.client-task-board {
  border: 1px solid #1f2a3b;
  border-radius: 10px;
  overflow: hidden;
}

.client-task-head,
.client-task-row {
  display: grid;
  grid-template-columns: 2fr 140px 160px 140px;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
}

.client-task-head {
  background: #0f1520;
  color: var(--muted);
  font-size: 13px;
  border-bottom: 1px solid #1f2a3b;
}

.client-task-row {
  border-bottom: 1px solid #1f2a3b;
}

.client-task-row:last-child {
  border-bottom: none;
}

.client-task-modal-actions {
  justify-content: flex-end;
}

.button-ghost {
  background: transparent;
  border: 1px solid #2a3342;
  color: #cbd5e1;
  white-space: nowrap;
}

.button-ghost:hover {
  border-color: #60a5fa;
  color: #e2e8f0;
}

.expand-btn {
  width: auto;
  height: auto;
  padding: 0 4px;
  border: none;
  background: transparent;
  color: #93c5fd;
  cursor: pointer;
  line-height: 1;
  font-size: 18px;
}

.expand-btn:hover {
  color: #bfdbfe;
}

.expand-btn.open {
  transform: rotate(90deg);
}

.project-tasks-row {
  border-bottom: 1px solid #1f2a3b;
  background: #0d1420;
}

.project-tasks-wrap {
  padding: 10px 14px 12px 44px;
}

.project-tasks-footer {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 28px 1.7fr 120px 160px 170px;
  align-items: center;
  gap: 10px;
}

.project-tasks-footer .button {
  justify-self: start;
  white-space: nowrap;
}

.mini-task {
  display: grid;
  grid-template-columns: 28px 1.7fr 120px 160px 170px;
  gap: 10px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #1a2232;
}

.mini-task:last-child {
  border-bottom: none;
}

.mini-task-open {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  color: #ffffff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.mini-task-open:hover {
  text-decoration: underline;
}

.mini-task-rename {
  margin-left: 8px;
  background: transparent;
  border: 1px solid #2a3342;
  color: #cbd5e1;
  border-radius: 6px;
  padding: 0 6px;
  line-height: 18px;
  height: 20px;
  cursor: pointer;
}

.mini-task-rename:hover {
  border-color: #60a5fa;
  color: #e2e8f0;
}

.mini-task-title-edit {
  width: 100%;
  background: #0f131a;
  border: 1px solid #2b3546;
  color: var(--text);
  border-radius: 6px;
  padding: 4px 6px;
}

.mini-task-head {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.my-task-board {
  background: #0d1420;
  border: 1px solid #1f2a3b;
  border-radius: 12px;
  padding: 12px 14px;
  overflow-x: auto;
}

.my-tasks-page-header {
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.my-tasks-mode {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.my-tasks-switch {
  position: relative;
  width: 42px;
  height: 22px;
  display: inline-flex;
  align-items: center;
}

.my-tasks-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.my-tasks-switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #1f2937;
  border: 1px solid #2b3546;
  transition: background 0.2s ease;
  cursor: pointer;
}

.my-tasks-switch-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  border-radius: 50%;
  background: #e5e7eb;
  transition: transform 0.2s ease;
}

.my-tasks-switch input:checked + .my-tasks-switch-slider {
  background: #1d4ed8;
}

.my-tasks-switch input:checked + .my-tasks-switch-slider::before {
  transform: translateX(20px);
}

.my-task-groups {
  display: grid;
  gap: 12px;
}

.my-task-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
}

.assignee-subgroup {
  display: grid;
  gap: 6px;
}

.assignee-subgroup-head {
  padding-left: 0;
}

.my-task-grid {
  grid-template-columns: 28px minmax(220px, 1.9fr) minmax(160px, 1.3fr) 140px 160px 180px 108px;
}

.my-task-empty {
  padding: 10px 0;
}

.assignee-board {
  background: #0d1420;
  border: 1px solid #1f2a3b;
  border-radius: 12px;
  overflow: hidden;
}

.assignee-head,
.assignee-row {
  display: grid;
  grid-template-columns: 28px 1fr 80px;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
}

.assignee-head {
  color: var(--muted);
  font-size: 12px;
  border-bottom: 1px solid #1f2a3b;
}

.assignee-row {
  border-bottom: 1px solid #1a2232;
}

.assignee-row:last-of-type {
  border-bottom: none;
}

.assignee-tasks-wrap {
  padding-left: 52px;
}

.assignee-task-head,
.assignee-task-row {
  grid-template-columns: 28px minmax(220px, 1.8fr) minmax(140px, 1.2fr) 140px 160px 180px 108px;
}

.password-board {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #111824;
}

.password-head,
.password-row {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 140px 1fr 1fr 110px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}

.password-row.with-project,
.password-head.with-project {
  grid-template-columns: 1.2fr 1.2fr 140px 1fr 1fr 110px;
}

.password-head {
  color: var(--muted);
  font-size: 13px;
  background: #0f1520;
  border-bottom: 1px solid var(--border);
}

.password-row {
  border-bottom: 1px solid var(--border);
  background: #141d2a;
}

.password-empty {
  padding: 12px 10px;
}

.password-copy-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
}

.password-copy-btn {
  padding: 4px 0;
  min-width: 34px;
  width: 34px;
  text-align: center;
  font-size: 14px;
}

.password-kind {
  width: 100%;
  border-radius: 8px;
  padding: 6px 8px;
  border: 1px solid #2b3546;
  color: #dbeafe;
  background: #0f131a;
}

.password-kind.kind-service {
  border-color: #2563eb;
  background: #14294f;
}

.password-kind.kind-hosting {
  border-color: #0f766e;
  background: #103733;
}

.password-kind.kind-admin_panel {
  border-color: #9a3412;
  background: #3a1f16;
}

.password-actions form {
  margin: 0;
}

.history-board {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #111824;
}

.history-head,
.history-row {
  display: grid;
  grid-template-columns: 180px 150px 1fr 150px;
  gap: 10px;
  align-items: start;
  padding: 8px 10px;
}

.history-head {
  color: var(--muted);
  font-size: 13px;
  background: #0f1520;
  border-bottom: 1px solid var(--border);
}

.history-row {
  border-bottom: 1px solid var(--border);
  background: #141d2a;
}

.history-details {
  white-space: pre-wrap;
  margin: 0;
  font-family: Consolas, monospace;
  font-size: 12px;
  color: #cbd5e1;
}

.history-sub-item {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #2b3546;
}

.history-row.undone {
  opacity: 0.7;
}

.assignee-task-head {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.archive-head,
.archive-project-row {
  grid-template-columns: minmax(220px, 1fr) 140px;
}

.archive-empty {
  padding: 4px 14px 10px 52px;
}

.archive-wrap {
  padding: 0 14px 10px 52px;
}

.archive-wrap .assignee-task-head,
.archive-wrap .assignee-task-row,
.archive-wrap-admin .assignee-task-head,
.archive-wrap-admin .assignee-task-row {
  grid-template-columns: 28px minmax(240px, 2fr) 140px 140px 180px 220px;
}

.archive-project-delete {
  margin-left: 10px;
  padding: 4px 8px;
  font-size: 12px;
}

.archive-project-head {
  grid-template-columns: 28px 1fr 100px;
}

.archive-project-row {
  grid-template-columns: 28px 1fr 100px;
}

.archive-project-head-admin {
  grid-template-columns: 28px 28px 1fr 100px;
}

.archive-project-row-admin {
  grid-template-columns: 28px 28px 1fr 100px;
}

[data-archive-project-bulk-bar].active {
  top: 118px;
}

@media (max-width: 980px) {
  .my-task-grid {
    grid-template-columns: 28px minmax(180px, 1.6fr) minmax(120px, 1fr) 130px 150px 160px 100px;
  }

  .assignee-task-head,
  .assignee-task-row {
    grid-template-columns: 28px minmax(180px, 1.5fr) minmax(120px, 1fr) 130px 150px 160px 100px;
  }

  .password-head,
  .password-row {
    min-width: 1120px;
  }
}

.task-row:last-child {
  border-bottom: none;
}

.col-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drag-handle {
  color: #6b7280;
  cursor: grab;
  user-select: none;
  font-size: 14px;
}

.task-row.dragging {
  opacity: 0.6;
}

.task-icon {
  color: #3b82f6;
  font-size: 14px;
}

.task-title {
  background: transparent;
  border: none;
  color: var(--text);
  font-weight: 600;
  width: 100%;
  padding: 4px 4px;
}

.task-title:focus {
  outline: 1px solid #2b3546;
  border-radius: 6px;
}

.task-owner,
.task-date,
.task-project,
.status-select {
  background: #0f131a;
  border: 1px solid #222c3a;
  color: var(--text);
  border-radius: 6px;
  padding: 4px 6px;
  width: 100%;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0.95;
  filter: invert(86%) sepia(8%) saturate(309%) hue-rotate(179deg) brightness(108%) contrast(98%);
  cursor: pointer;
}

input[type="date"]::-webkit-datetime-edit,
input[type="date"]::-webkit-datetime-edit-year-field,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field {
  color: var(--text);
}

.task-date.due-empty::-webkit-datetime-edit {
  color: transparent;
}

.task-date.due-empty:focus::-webkit-datetime-edit {
  color: var(--text);
}

.task-date.due-empty::-webkit-calendar-picker-indicator {
  opacity: 1;
  filter:
    invert(65%)
    sepia(100%)
    saturate(400%)
    hue-rotate(185deg)
    brightness(120%)
    drop-shadow(0 0 4px #3b82f6)
    drop-shadow(0 0 10px #3b82f6);
}

.task-date.due-overdue {
  border-color: #dc2626;
  background: rgba(220, 38, 38, 0.12);
  color: #fecaca;
}

.task-date.due-today {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.14);
  color: #fde68a;
}

.status-select.in-progress {
  border-color: #1e40af;
  color: #93c5fd;
}

.status-select.done {
  border-color: #16a34a;
  color: #86efac;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #1f2937;
  color: #cbd5e1;
}

.status-pill.in-progress {
  background: #1e3a8a;
  color: #bfdbfe;
}

.status-pill.done {
  background: #166534;
  color: #bbf7d0;
}

.desc-btn {
  background: transparent;
  border: 1px solid #2a3342;
  color: #cbd5e1;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
}

.desc-btn:hover {
  border-color: #60a5fa;
  color: #e2e8f0;
}

.dark-check {
  width: 16px;
  height: 16px;
  accent-color: #1f2937;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.checkboxes { display: grid; gap: 6px; }

.check { display: flex; align-items: center; gap: 8px; }

.logout button { background: #dc2626; }
.logout button:hover { background: #b91c1c; }

.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #1f2937;
  color: #cbd5e1;
  font-size: 12px;
  vertical-align: middle;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row-actions form {
  margin: 0;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}

.modal.open {
  display: flex;
}

.modal-card {
  background: #121823;
  border: 1px solid #232b36;
  border-radius: 10px;
  padding: 16px;
  width: 100%;
  max-width: 420px;
}

.modal-form {
  display: grid;
  gap: 8px;
}

.modal-project-create {
  max-width: 620px;
}

.modal-two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal-two-cols > div {
  min-width: 0;
}

.modal-task-view {
  width: min(96vw, 1500px);
  max-width: min(96vw, 1500px);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
}

.modal-task-view .modal-form {
  flex: 1;
  overflow: auto;
  padding-right: 4px;
}

.task-view-list {
  max-height: 220px;
  overflow: auto;
  border: 1px solid #232b36;
  border-radius: 8px;
  background: #0f1624;
  padding: 8px 10px;
}

#task-view-description,
#task-view-report-input {
  resize: none;
}

.wysiwyg {
  border: 1px solid #232b36;
  border-radius: 8px;
  background: #0f1624;
}

.wysiwyg-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  border-bottom: 1px solid #232b36;
}

.wysiwyg-toolbar button {
  background: transparent;
  border: 1px solid #2a3342;
  color: #cbd5e1;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
}

.wysiwyg-toolbar button:hover {
  border-color: #60a5fa;
  color: #e2e8f0;
}

.wysiwyg-editor {
  min-height: 120px;
  max-height: 40vh;
  overflow: auto;
  padding: 10px;
  outline: none;
  color: var(--text);
}

.wysiwyg-editor img {
  display: block;
  max-width: 100%;
  max-height: 220px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  margin: 8px 0;
}

.task-view-list img,
.client-readonly-block img {
  display: block;
  max-width: 100%;
  max-height: 220px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  margin: 8px 0;
}

.wysiwyg-hidden {
  display: none;
}

.report-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: sticky;
  bottom: 0;
  background: #121823;
  padding-top: 8px;
  border-top: 1px solid #232b36;
}

#task-view-attach-btn {
  min-width: 52px;
  min-height: 42px;
  background: transparent;
  border: 1px solid #2a3342;
  color: #cbd5e1;
  font-size: 22px;
  line-height: 1;
  padding: 6px 12px;
}

#task-view-attach-btn:hover {
  border-color: #60a5fa;
  color: #e2e8f0;
}

.task-modal-actions {
  justify-content: flex-end;
}

[data-project-task-bulk-bar].active {
  top: 112px;
}

@media (max-width: 720px) {
  .modal-two-cols {
    grid-template-columns: 1fr;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.modal-close {
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 16px;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 16px;
}

.confirm-text {
  color: var(--text);
  margin-top: 6px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #0f1624;
  border: 1px solid #2b3546;
  color: #e5e7eb;
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 60;
}

.toast.show {
  opacity: 1;
}

.mobile-account-links,
.menu-backdrop {
  display: none;
}

@media (max-width: 720px) {
  body {
    overflow-x: hidden;
    font-size: 13px;
  }

  button,
  .button {
    font-size: 12px;
    padding: 6px 9px;
  }

  .brand-text-static {
    font-size: 14px;
  }

  .topbar {
    min-height: 48px;
    padding: 6px 10px;
    gap: 8px;
  }

  .brand {
    display: flex;
    align-items: center;
    min-width: 0;
  }

  .brand-text-static {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .brand > .brand-link {
    display: none;
  }

  .burger {
    flex: 0 0 auto;
    width: 34px;
    height: 32px;
    margin-right: 7px;
    padding: 4px 8px;
  }

  .logout button {
    min-height: 32px;
    padding: 5px 9px;
    font-size: 12px;
  }

  .app-shell {
    padding-top: 48px;
  }

  .container {
    width: 100%;
    max-width: 520px;
    margin: 8px auto 18px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .full-width,
  body.menu-open .full-width,
  .page-header,
  body.menu-open .page-header {
    width: 100%;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 0;
    padding-right: 0;
  }

  .page-header {
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 7px;
  }

  .page-title {
    margin: 2px 0;
    font-size: 16px;
  }

  body.list-scroll-page .page-header {
    position: static;
    padding-top: 0;
  }

  .side-menu {
    top: 48px;
    width: min(280px, calc(100vw - 48px));
    height: calc(100dvh - 48px);
    overflow-y: auto;
    z-index: 42;
    box-shadow: 18px 0 40px rgba(0, 0, 0, 0.38);
  }

  .side-list {
    min-height: calc(100dvh - 104px);
  }

  .mobile-account-links {
    display: block;
    margin-top: 4px;
    border: 1px solid #1f2733;
    border-radius: 8px;
  }

  .mobile-account-links .tree-link {
    padding: 8px 10px;
    color: #7dd3fc;
  }

  .menu-backdrop {
    position: fixed;
    inset: 48px 0 0;
    z-index: 41;
    width: 100%;
    height: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(3, 7, 18, 0.64);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
  }

  body.menu-open .menu-backdrop {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  body.menu-open .container {
    margin-left: auto;
  }

  .grid,
  .modal-two-cols,
  .form-actions,
  .auth-row {
    grid-template-columns: 1fr;
  }

  .auth-row input,
  .auth-form input,
  .form-actions button {
    width: 100%;
    max-width: 100%;
  }

  input,
  select,
  textarea {
    min-width: 0;
    font-size: 14px;
    padding: 6px 8px;
  }

  .card {
    padding: 9px;
    margin-bottom: 7px;
  }

  body.list-scroll-page .list-scroll-area,
  .list-scroll-area {
    max-height: none;
    overflow-x: visible;
    overflow-y: visible;
    padding-bottom: 84px;
  }

  .project-board,
  .task-board,
  .my-task-board,
  .assignee-board,
  .password-board,
  .history-board,
  .client-task-board {
    display: grid;
    gap: 6px;
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .project-header,
  .task-header,
  .my-task-head,
  .assignee-head,
  .assignee-task-head,
  .password-head,
  .history-head,
  .client-task-head,
  .template-head,
  .archive-head {
    display: none;
  }

  .project-row,
  .task-row,
  .mini-task,
  .assignee-row,
  .assignee-task-row,
  .password-row,
  .history-row,
  .client-task-row,
  .template-row,
  .archive-project-row,
  .archive-project-row-admin {
    min-width: 0;
    padding: 8px 9px;
    gap: 6px;
    border: 1px solid #263246;
    border-radius: 8px;
    background: #141d2a;
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.16);
  }

  .project-row {
    position: relative;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
  }

  .project-row > :nth-child(1) { grid-column: 1; grid-row: 1; }
  .project-row > :nth-child(2) { grid-column: 3; grid-row: 1; }
  .project-row > :nth-child(3) { grid-column: 2; grid-row: 1; }
  .project-row > :nth-child(n + 4) { grid-column: 1 / -1; }

  .project-name-cell {
    white-space: normal;
    overflow: visible;
  }

  .project-row > :nth-child(5)::before,
  .project-row > :nth-child(6)::before,
  .project-row > :nth-child(7)::before,
  .my-task-grid:not(.my-task-head) > :nth-child(3)::before,
  .my-task-grid:not(.my-task-head) > :nth-child(4)::before,
  .my-task-grid:not(.my-task-head) > :nth-child(5)::before,
  .my-task-grid:not(.my-task-head) > :nth-child(6)::before {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .project-row > :nth-child(5)::before { content: '% выполнено'; }
  .project-row > :nth-child(6)::before { content: 'Создатель'; }
  .project-row > :nth-child(7)::before { content: 'Дата создания'; }
  .my-task-grid:not(.my-task-head) > :nth-child(3)::before { content: 'Проект'; }
  .my-task-grid:not(.my-task-head) > :nth-child(4)::before { content: 'Статус'; }
  .my-task-grid:not(.my-task-head) > :nth-child(5)::before { content: 'Срок'; }
  .my-task-grid:not(.my-task-head) > :nth-child(6)::before { content: 'Ответственный'; }

  .my-task-grid:not(.my-task-head),
  .assignee-task-row,
  .task-row,
  .client-task-row,
  .password-row,
  .password-row.with-project,
  .history-row,
  .template-row {
    grid-template-columns: 1fr;
  }

  .my-task-grid:not(.my-task-head) {
    grid-template-columns: 28px 1fr;
  }

  .my-task-grid:not(.my-task-head) > :first-child {
    grid-column: 1;
    grid-row: 1;
  }

  .my-task-grid:not(.my-task-head) > :nth-child(2) {
    grid-column: 2;
    grid-row: 1;
  }

  .my-task-grid:not(.my-task-head) > :nth-child(n + 3) {
    grid-column: 1 / -1;
  }

  .mini-task-open,
  .task-title,
  .project-name-cell {
    font-size: 13px;
    line-height: 1.25;
  }

  .assignee-tasks-wrap,
  .archive-wrap,
  .archive-wrap-admin {
    padding-left: 0;
  }

  .project-tasks-row {
    padding: 0;
  }

  .project-tasks-wrap {
    padding: 6px 0 10px;
  }

  .bulk-bar,
  body.list-scroll-page .bulk-bar,
  [data-project-task-bulk-bar].active,
  [data-archive-project-bulk-bar].active {
    top: auto;
    right: 8px;
    bottom: 8px;
    left: 8px;
    width: auto;
    max-width: 504px;
    max-height: 72px;
    margin: 0 auto;
    padding: 6px 8px;
    transform: none;
    overflow: hidden;
    flex-direction: row;
    align-items: center;
    z-index: 45;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.42);
  }

  .bulk-count {
    flex: 0 0 auto;
    font-size: 11px;
    white-space: nowrap;
  }

  .bulk-controls {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    gap: 5px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
  }

  .bulk-controls select,
  .bulk-controls input,
  .bulk-controls button {
    flex: 0 0 auto;
    width: auto;
    max-width: 152px;
    margin: 0;
    min-height: 32px;
    padding: 5px 8px;
    font-size: 11px;
  }

  .bulk-controls select,
  .bulk-controls input {
    flex: 0 0 132px;
    width: 132px;
  }

  .modal {
    padding: 12px;
    align-items: flex-start;
  }

  .modal-card {
    width: min(calc(100vw - 24px), 520px);
    max-width: 520px;
    max-height: calc(100dvh - 24px);
    margin: auto;
    padding: 12px;
    overflow-y: auto;
  }

  .modal-task-view {
    width: min(calc(100vw - 24px), 520px);
    max-width: 520px;
    max-height: calc(100dvh - 24px);
  }

  .modal-actions,
  .report-actions,
  .row-actions,
  .actions,
  .project-create-actions,
  .inline-add {
    flex-wrap: wrap;
  }

  .wysiwyg-toolbar {
    gap: 4px;
  }

  .wysiwyg-toolbar button {
    padding: 6px 8px;
  }

  .task-table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }

  /* Minimal mobile list: narrow, quiet cards and no floating overlays. */
  .project-board,
  .task-board,
  .my-task-board,
  .assignee-board,
  .password-board,
  .history-board,
  .client-task-board,
  .my-task-groups,
  .my-task-group {
    width: 100%;
    max-width: 360px;
    margin-inline: auto;
  }

  .project-row,
  .task-row,
  .mini-task,
  .assignee-row,
  .assignee-task-row,
  .password-row,
  .history-row,
  .client-task-row,
  .template-row,
  .archive-project-row,
  .archive-project-row-admin {
    width: 100%;
    padding: 7px 8px;
    gap: 5px;
    border-color: #202a39;
    border-radius: 7px;
    box-shadow: none;
  }

  .project-row input,
  .project-row select,
  .mini-task input,
  .mini-task select,
  .task-row input,
  .task-row select {
    min-height: 28px;
    padding: 4px 6px;
    border-radius: 5px;
    font-size: 12px;
  }

  .project-row > :nth-child(5)::before,
  .project-row > :nth-child(6)::before,
  .project-row > :nth-child(7)::before,
  .my-task-grid:not(.my-task-head) > :nth-child(3)::before,
  .my-task-grid:not(.my-task-head) > :nth-child(4)::before,
  .my-task-grid:not(.my-task-head) > :nth-child(5)::before,
  .my-task-grid:not(.my-task-head) > :nth-child(6)::before {
    font-size: 8px;
    margin-bottom: 1px;
  }

  .project-row > :nth-child(4),
  .project-row > :nth-child(5) {
    margin-top: 1px;
  }

  .project-row .button,
  .mini-task .button,
  .task-row .button,
  .mini-task-open {
    min-height: 27px;
    padding: 4px 7px;
    font-size: 11px;
  }

  .bulk-bar,
  body.list-scroll-page .bulk-bar,
  [data-project-task-bulk-bar].active,
  [data-archive-project-bulk-bar].active,
  body.menu-open .bulk-bar.active,
  body.list-scroll-page.menu-open .bulk-bar.active {
    position: static;
    width: 100%;
    max-width: 360px;
    max-height: none;
    margin: 0 auto 7px;
    padding: 5px 6px;
    transform: none;
    border-radius: 7px;
    box-shadow: none;
    overflow: hidden;
  }

  body.list-scroll-page .bulk-bar.active + .bulk-bar.active {
    top: auto;
  }

  .bulk-controls {
    padding-bottom: 1px;
  }

  .bulk-controls select,
  .bulk-controls input {
    flex-basis: 118px;
    width: 118px;
    min-height: 28px;
    padding: 3px 22px 3px 6px;
    font-size: 10px;
  }

  .bulk-controls button {
    min-height: 28px;
    padding: 4px 7px;
    font-size: 10px;
  }

  /* Task template pages use a dense two-row editor instead of stacked cards. */
  .full-width[data-template-base] .task-board {
    max-width: 420px;
    gap: 5px;
  }

  .full-width[data-template-base] .task-row {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) auto auto;
    align-items: center;
    padding: 7px;
    gap: 5px;
  }

  .full-width[data-template-base] .task-row .col-check {
    grid-column: 1;
    grid-row: 1 / 3;
    align-self: start;
    padding-top: 3px;
  }

  .full-width[data-template-base] .task-row .col-title {
    grid-column: 2 / 5;
    grid-row: 1;
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 4px;
    min-width: 0;
  }

  .full-width[data-template-base] .task-row .task-title {
    width: 100%;
    min-width: 0;
    height: 34px;
    min-height: 34px;
    padding: 2px 4px;
    border: 0;
    background: transparent;
    overflow: hidden;
    resize: none;
    white-space: normal;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.25;
  }

  .full-width[data-template-base] .task-row .desc-btn {
    padding: 3px 6px;
    font-size: 10px;
  }

  .full-width[data-template-base] .task-row .col-date {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
  }

  .full-width[data-template-base] .task-row .task-date {
    width: 122px;
    max-width: 100%;
  }

  .full-width[data-template-base] .task-row .col-status {
    grid-column: 3;
    grid-row: 2;
  }

  .full-width[data-template-base] .task-row .col-actions {
    grid-column: 4;
    grid-row: 2;
  }

  .full-width[data-template-base] .task-row .status-pill {
    padding: 3px 6px;
    font-size: 9px;
    white-space: nowrap;
  }

  .full-width[data-template-base] .task-row .button-danger {
    min-height: 26px;
    padding: 3px 6px;
    font-size: 10px;
  }

  .full-width[data-template-base] > .bulk-bar {
    display: none;
    max-width: 420px;
    padding: 6px;
  }

  .full-width[data-template-base] > .bulk-bar.active {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .full-width[data-template-base] > .bulk-bar .bulk-left {
    font-size: 10px;
  }

  .full-width[data-template-base] > .bulk-bar .bulk-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 5px;
    overflow: visible;
  }

  .full-width[data-template-base] > .bulk-bar .bulk-controls select,
  .full-width[data-template-base] > .bulk-bar .bulk-controls input,
  .full-width[data-template-base] > .bulk-bar .bulk-controls button {
    width: 100%;
    max-width: none;
    min-width: 0;
    min-height: 28px;
    margin: 0;
  }
}
