/* TaskFlow — оформление доски задач */

:root {
  color-scheme: dark;

  --bg: #2d3a4f;
  --bg-glow-1: rgba(125, 160, 235, 0.15);
  --bg-glow-2: rgba(180, 155, 240, 0.11);
  --panel: #394962;
  --panel-soft: #334257;
  --card: #465873;
  --card-hover: #526581;
  --border: #5a6d88;
  --border-strong: #788ba7;

  --text: #f0f4fa;
  --text-soft: #d0dbeb;
  --text-muted: #c4d1e2;

  --accent: #9aa7ff;
  --accent-soft: rgba(154, 167, 255, 0.18);
  --accent-text: #dde2ff;

  --today: #f6c273;
  --tomorrow: #8ac8f7;
  --week: #aab5fb;
  --later: #c6b3ff;
  --done: #77dda9;
  --danger: #f7a6a6;

  --radius: 16px;
  --radius-sm: 12px;
  --shadow-card: 0 8px 22px rgba(9, 14, 24, 0.26);
  --shadow-column: 0 10px 26px rgba(9, 14, 24, 0.16);
  --shadow-modal: 0 32px 80px rgba(5, 8, 15, 0.5);
}

html[data-theme="light"] {
  color-scheme: light;

  --bg: #eef1f7;
  --bg-glow-1: rgba(70, 110, 200, 0.10);
  --bg-glow-2: rgba(130, 100, 200, 0.07);
  --panel: #ffffff;
  --panel-soft: #f5f7fb;
  --card: #ffffff;
  --card-hover: #ffffff;
  --border: #dfe5ef;
  --border-strong: #c8d2e0;

  --text: #1a2330;
  --text-soft: #4b586b;
  --text-muted: #5f6e84;

  --accent: #5b5ef0;
  --accent-soft: rgba(99, 102, 241, 0.10);
  --accent-text: #4b4fd6;

  --today: #b9791c;
  --tomorrow: #2b7cb8;
  --week: #4a57c9;
  --later: #7c4fd0;
  --done: #2f9e68;
  --danger: #c94b4b;

  --shadow-card: 0 4px 14px rgba(15, 23, 42, 0.06);
  --shadow-modal: 0 30px 70px rgba(15, 23, 42, 0.22);
  --shadow-column: 0 6px 18px rgba(15, 23, 42, 0.05);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Inter", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 460px at 12% -12%, var(--bg-glow-1), transparent 62%),
    radial-gradient(760px 420px at 92% -4%, var(--bg-glow-2), transparent 60%);
  z-index: 0;
}

body.is-dragging {
  cursor: grabbing;
}

button {
  font: inherit;
  color: inherit;
}

kbd {
  font-family: inherit;
  font-size: 11.5px;
  padding: 1px 5px;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  background: var(--panel-soft);
  color: var(--text-soft);
}

/* ---------- каркас ---------- */

.app {
  position: relative;
  z-index: 1;
  height: 100vh;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

/* ---------- верхняя панель ---------- */

.app-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 22px 12px;
}

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

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex: none;
}

.brand-text {
  min-width: 0;
}

.brand-title {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-date {
  margin: 0;
  font-size: 16px;
  color: var(--text-soft);
  white-space: nowrap;
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.brand-sep {
  opacity: 0.45;
}

.brand-clock {
  color: var(--text);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.stats {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 4px;
  flex-wrap: wrap;
}

.stat {
  font-size: 13px;
  color: var(--text-soft);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.stat-danger {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.28);
}

html[data-theme="light"] .stat-danger {
  color: #b91c1c;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 0 10px;
  height: 36px;
  transition: border-color 0.15s, box-shadow 0.15s, width 0.18s;
}

.search .ic {
  color: var(--text-muted);
  display: flex;
}

.search input {
  width: 168px;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 0 0 0 8px;
  transition: width 0.18s;
}

.search input::placeholder {
  color: var(--text-muted);
}

.search input::-webkit-search-cancel-button {
  filter: grayscale(1);
  opacity: 0.6;
}

.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search:focus-within input {
  width: 220px;
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 2px;
  height: 36px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}

.icon-btn:hover {
  background: rgba(148, 163, 184, 0.14);
  color: var(--text);
}

.icon-btn:active {
  transform: scale(0.95);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 11px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.32);
}

.btn.primary:hover {
  box-shadow: 0 8px 22px rgba(99, 102, 241, 0.45);
  filter: brightness(1.06);
}

.btn.ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-soft);
}

.btn.ghost:hover {
  background: var(--panel-soft);
  color: var(--text);
}

.btn.danger-ghost {
  background: transparent;
  color: #f87171;
  padding-left: 8px;
  padding-right: 10px;
}

html[data-theme="light"] .btn.danger-ghost {
  color: #dc2626;
}

.btn.danger-ghost:hover {
  background: rgba(239, 68, 68, 0.12);
}

/* ---------- подсказка ---------- */

.hint {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 22px 12px;
  padding: 9px 10px 9px 14px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid rgba(143, 157, 255, 0.24);
  color: var(--text-soft);
  font-size: 13.5px;
}

.hint p {
  margin: 0;
  flex: 1;
}

.hint strong {
  color: var(--text);
  font-weight: 600;
}

.hint .icon-btn:hover {
  background: rgba(148, 163, 184, 0.16);
}

/* ---------- доска ---------- */

.board {
  display: flex;
  gap: 10px;
  padding: 0 22px 8px;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 0;
}

.column {
  flex: 1 1 0;
  min-width: 230px;
  box-shadow: var(--shadow-column);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.column.is-drop {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}


.col-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 13px 10px 9px 15px;
  min-height: 54px;
  flex: none;
}

.col-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  margin-top: 6px;
  background: var(--text-muted);
}

.col-dot[data-col="overdue"] { background: var(--danger); box-shadow: 0 0 10px rgba(229, 115, 115, 0.45); }
.col-dot[data-col="today"] { background: var(--today); box-shadow: 0 0 10px rgba(227, 163, 60, 0.45); }
.col-dot[data-col="tomorrow"] { background: var(--tomorrow); box-shadow: 0 0 10px rgba(95, 168, 232, 0.45); }
.col-dot[data-col="week"] { background: var(--week); box-shadow: 0 0 10px rgba(127, 143, 240, 0.45); }
.col-dot[data-col="later"] { background: var(--later); box-shadow: 0 0 10px rgba(167, 139, 250, 0.42); }
.col-dot[data-col="done"] { background: var(--done); box-shadow: 0 0 10px rgba(76, 195, 138, 0.42); }

.col-title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1.32;
  color: var(--text);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.col-count {
  flex: none;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

.col-count.is-zero {
  opacity: 0.45;
}

.col-actions {
  display: flex;
  gap: 2px;
  margin-top: -3px;
  opacity: 0.55;
  transition: opacity 0.15s;
}

.column:hover .col-actions,
.col-actions:focus-within {
  opacity: 1;
}

.col-actions .icon-btn {
  width: 26px;
  height: 26px;
}

.col-body {
  flex: 1 1 auto;
  min-height: 60px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
}

.col-body::-webkit-scrollbar {
  width: 9px;
}

.col-body::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.col-body::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.45);
  background-clip: content-box;
}

/* ---------- пустой столбец ---------- */

.col-empty {
  margin: 2px 0 auto;
  padding: 24px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.col-empty .ic {
  opacity: 0.5;
  margin-bottom: 2px;
}

.col-empty strong {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-soft);
}

.col-empty small {
  font-size: 12.5px;
  line-height: 1.45;
  max-width: 200px;
}

/* ---------- карточка ---------- */

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 11px 9px;
  cursor: grab;
  flex: none;
  transition: background 0.14s, border-color 0.14s, box-shadow 0.14s, opacity 0.14s;
  animation: card-in 0.18s ease both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.card:hover {
  background: var(--card-hover);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-card);
}

.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card.is-dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.card.is-overdue {
  border-left: 2px solid var(--danger);
  padding-left: 10px;
}

.card.is-done .card-title {
  color: var(--text-soft);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(34, 197, 94, 0.65);
}

.card.is-new {
  animation: card-new 0.5s ease;
}

@keyframes card-new {
  0% { box-shadow: 0 0 0 3px var(--accent-soft); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.card-head {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.card-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.38;
  letter-spacing: -0.005em;
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.card-tools {
  display: flex;
  gap: 1px;
  margin: -3px -4px 0 0;
  opacity: 0;
  transition: opacity 0.12s;
}

.card:hover .card-tools,
.card:focus-within .card-tools {
  opacity: 1;
}

.card-tools .icon-btn {
  width: 25px;
  height: 25px;
  color: var(--text-muted);
}

.card-tools .icon-btn:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.16);
}

.card-tools .icon-btn.act-complete:hover {
  color: var(--done);
  background: rgba(34, 197, 94, 0.14);
}

.card-tools .icon-btn.act-delete:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.14);
}

.card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 550;
  line-height: 1.4;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge .ic {
  display: flex;
  opacity: 0.9;
}

.badge-deadline.kind-today {
  color: #eec27a;
  background: rgba(227, 163, 60, 0.14);
  border-color: rgba(227, 163, 60, 0.32);
}

.badge-deadline.kind-overdue {
  color: #f0a3a3;
  background: rgba(229, 115, 115, 0.14);
  border-color: rgba(229, 115, 115, 0.34);
}

.badge-deadline.kind-tomorrow {
  color: #9ccdf3;
  background: rgba(95, 168, 232, 0.14);
  border-color: rgba(95, 168, 232, 0.30);
}

.badge-deadline.kind-week {
  color: #b8c0fb;
  background: rgba(127, 143, 240, 0.13);
  border-color: rgba(127, 143, 240, 0.26);
}

.badge-deadline.kind-later {
  color: var(--text-soft);
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.18);
}

.badge-deadline.kind-none {
  color: var(--text-muted);
  background: transparent;
  border: 1px dashed var(--border-strong);
}

.badge-deadline.is-clickable {
  cursor: pointer;
}

.badge-deadline.is-clickable:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}

.badge-deadline.is-clickable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.badge-repeat {
  color: #b9c2ff;
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.3);
}

html[data-theme="light"] .badge-repeat {
  color: #4338ca;
  background: rgba(99, 102, 241, 0.09);
  border-color: rgba(99, 102, 241, 0.24);
}

.badge-important {
  color: #cfc4ff;
  background: rgba(124, 92, 255, 0.20);
  border-color: rgba(124, 92, 255, 0.45);
}

.badge-urgent {
  color: #f2b8b4;
  background: rgba(217, 83, 79, 0.18);
  border-color: rgba(217, 83, 79, 0.42);
}

.badge-important,
.badge-urgent {
  font-weight: 600;
  padding: 2px 8px;
}

html[data-theme="light"] .badge-important {
  color: #5b45c9;
  background: rgba(124, 92, 255, 0.12);
  border-color: rgba(124, 92, 255, 0.35);
}

html[data-theme="light"] .badge-urgent {
  color: #a63c3c;
  background: rgba(217, 83, 79, 0.10);
  border-color: rgba(217, 83, 79, 0.32);
}

html[data-theme="light"] .badge-deadline.kind-today { color: #9a6412; }
html[data-theme="light"] .badge-deadline.kind-overdue { color: #a63c3c; }
html[data-theme="light"] .badge-deadline.kind-tomorrow { color: #1d6ea8; }
html[data-theme="light"] .badge-deadline.kind-week { color: #3f4bb5; }

.link-btn {
  justify-self: start;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 0;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: rgba(124, 140, 248, 0.45);
  text-underline-offset: 2px;
}

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

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2px 8px;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.card-foot > span {
  white-space: nowrap;
}

.card-foot .done-mark {
  color: #4ade80;
}

html[data-theme="light"] .card-foot .done-mark {
  color: #15803d;
}

/* ---------- нижняя строка ---------- */

.app-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 22px 10px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.foot-keys {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.dot-sep {
  opacity: 0.5;
  margin: 0 2px;
}

.foot-note {
  text-align: right;
}

/* ---------- модальное окно ---------- */

body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(5, 8, 14, 0.6);
  backdrop-filter: blur(5px);
  animation: fade-in 0.15s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  width: min(1520px, calc(100vw - 24px));
  height: calc(100vh - 24px);
  max-height: calc(100vh - 24px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: var(--shadow-modal);
  padding: 18px 22px 14px;
  animation: modal-in 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

#task-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

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

.modal-head h2 {
  margin: 0;
  font-size: 17.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  gap: 4px 26px;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

.form-col {
  min-width: 0;
  min-height: 0;
}

.form-main {
  display: flex;
  flex-direction: column;
}

.form-side {
  display: flex;
  flex-direction: column;
}

.form-side .attachments-field {
  margin-top: auto;
}

.field {
  display: block;
  margin-bottom: 13px;
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.field input,
.field textarea {
  width: 100%;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  padding: 9px 11px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field textarea {
  resize: vertical;
  min-height: 84px;
  line-height: 1.5;
}

.field-desc {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.field-desc textarea {
  flex: 1;
  height: auto;
  min-height: 220px;
  resize: none;
}

.field-desc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.field-desc-head .field-label {
  margin-bottom: 0;
}

.checklist-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.checklist-toggle:hover,
.checklist-toggle.is-open {
  color: var(--text);
  border-color: var(--border-strong);
  background: rgba(148, 163, 184, 0.1);
}

.checklist-toggle.has-items {
  color: var(--accent-text);
}

.checklist-toggle .ic {
  width: 14px;
  height: 14px;
}

/* ---------- чек-лист ---------- */

.checklist-popover {
  position: fixed;
  z-index: 72;
  width: 520px;
  display: flex;
  flex-direction: column;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

.cl-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.cl-title {
  font-size: 16px;
  font-weight: 650;
  color: var(--text);
}

.cl-progress {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-muted);
}

.cl-close {
  width: 30px;
  height: 30px;
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
}

.cl-items {
  display: flex;
  flex-direction: column;
  flex: 0 1 auto;
  min-height: 0;
  gap: 2px;
  overflow-y: auto;
  padding-right: 4px;
}

.cl-items::-webkit-scrollbar {
  width: 8px;
}

.cl-items::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.28);
  border-radius: 4px;
}

.cl-items::-webkit-scrollbar-track {
  background: transparent;
}

.cl-items.is-dense,
.cl-items.is-three {
  display: flex;
  flex-direction: column;
}

.cl-empty {
  padding: 8px 2px;
  font-size: 13px;
  color: var(--text-muted);
}

.cl-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px;
  border-radius: 9px;
}

.cl-item:hover {
  background: rgba(148, 163, 184, 0.08);
}

.field .cl-check {
  appearance: none;
  position: relative;
  width: 20px;
  height: 20px;
  min-width: 20px;
  flex: none;
  padding: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}

.field .cl-check:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.field .cl-check:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.cl-text {
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
}

.cl-item.is-done .cl-text {
  color: var(--text-muted);
  text-decoration: line-through;
}

.cl-edit,
.cl-remove {
  opacity: 0.3;
  width: 28px;
  height: 28px;
  color: var(--text-muted);
}

.cl-edit {
  opacity: 0.5;
}

.cl-item:hover .cl-edit,
.cl-item:hover .cl-remove {
  opacity: 1;
}

.cl-edit-input {
  flex: 1;
  width: auto;
  min-width: 0;
  padding: 4px 8px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.cl-add {
  display: flex;
  flex: none;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.cl-add input {
  flex: 1;
  width: auto;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
}

.cl-add input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.cl-add-btn {
  padding: 9px 15px;
  font-size: 14px;
}

.cl-actions {
  display: flex;
  flex: none;
  justify-content: flex-end;
  margin-top: 14px;
}

.cl-empty {
  grid-column: 1 / -1;
}

#f-comment {
  height: 96px;
  min-height: 96px;
  resize: none;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-muted);
}

.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field input.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16);
  animation: shake 0.22s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  opacity: 0.65;
  cursor: pointer;
}

.quick-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

/* ---------- выбор дедлайна ---------- */

.deadline-display {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.deadline-display:hover {
  border-color: var(--border-strong);
}

.deadline-display:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.deadline-display.is-empty .deadline-text {
  color: var(--text-muted);
}

.field-error {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--danger);
}

.deadline-display.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(247, 166, 166, 0.18);
}

.deadline-icon {
  width: 24px;
  height: 24px;
  flex: none;
  color: var(--accent-text);
}

.datepicker {
  position: fixed;
  z-index: 70;
  width: 392px;
  padding: 14px 14px 12px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

.dp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.dp-title {
  flex: 1;
  text-align: center;
  font-size: 15.5px;
  font-weight: 650;
  text-transform: capitalize;
}

.dp-nav {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
}

.dp-nav:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.14);
}

.dp-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-bottom: 4px;
}

.dp-weekdays span {
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.dp-day {
  height: 40px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.dp-day:hover {
  background: rgba(148, 163, 184, 0.14);
}

.dp-day.is-other {
  color: var(--text-muted);
  opacity: 0.45;
}

.dp-day.is-today {
  border-color: var(--border-strong);
}

.dp-day.is-selected {
  background: var(--accent);
  color: #ffffff;
  font-weight: 650;
}

.dp-time {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.dp-time-label {
  margin-right: 2px;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dp-time select {
  appearance: none;
  width: 62px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-soft);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: center;
}

.dp-colon {
  color: var(--text-muted);
}

.dp-now {
  margin-left: auto;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: transparent;
  color: var(--accent-text);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

.dp-now:hover {
  background: rgba(148, 163, 184, 0.12);
}

.dp-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.dp-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 550;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s, color 0.14s;
}

.chip:hover {
  background: var(--accent-soft);
  border-color: rgba(143, 157, 255, 0.36);
  color: var(--text);
}

/* ---------- вложения ---------- */

.attachments-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 132px;
  overflow-y: auto;
  margin-bottom: 8px;
}

.attach-empty {
  font-size: 12px;
  color: var(--text-muted);
  padding: 2px 0;
}

.attach-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-soft);
  font-size: 12.5px;
}

.attach-row > .ic {
  color: var(--text-muted);
  flex: none;
}

.attach-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  cursor: pointer;
}

.attach-name:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.attach-size {
  flex: none;
  color: var(--text-muted);
  font-size: 11.5px;
}

.attach-row .icon-btn {
  width: 26px;
  height: 26px;
  flex: none;
}

.attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--text-soft);
  border-radius: 9px;
  padding: 6px 10px;
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.attach-btn:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-soft);
}

.attach-btn .ic {
  display: flex;
}

.badge-attach {
  color: var(--text-soft);
  background: rgba(148, 163, 184, 0.10);
  border-color: rgba(148, 163, 184, 0.22);
}

html[data-theme="light"] .badge-attach {
  color: #475569;
  background: rgba(100, 116, 139, 0.08);
  border-color: rgba(100, 116, 139, 0.20);
}

.badge-checklist {
  color: #9ee6c4;
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.28);
}

html[data-theme="light"] .badge-checklist {
  color: #047857;
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.24);
}

/* ---------- регулярные задачи ---------- */

.repeat-field {
  padding-top: 1px;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  font-size: 14px;
  color: var(--text-soft);
  cursor: pointer;
  user-select: none;
}

.switch-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.switch-box {
  position: relative;
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1.5px solid var(--border-strong);
  background: var(--panel-soft);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.switch-row input:checked + .switch-box {
  border-color: transparent;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.switch-row input:checked + .switch-box::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.switch-row input:focus-visible + .switch-box {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.switch-row:hover .switch-text {
  color: var(--text);
}

.switch-text {
  transition: color 0.15s;
}

.repeat-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 0;
}

.repeat-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 9px;
}

.repeat-control {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.repeat-control > span:first-child {
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.repeat-control-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.repeat-row select,
.repeat-row input[type="number"],
.repeat-row input[type="date"] {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 9px;
  background-color: var(--panel-soft);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.repeat-row select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237589b0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 15px 15px;
  padding-right: 28px;
  cursor: pointer;
}

.repeat-row input[type="number"] {
  width: 68px;
}

.repeat-row input[type="date"] {
  width: 138px;
}

.repeat-row select:focus,
.repeat-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.repeat-unit {
  font-size: 11.5px;
  color: var(--text-muted);
}

.repeat-hint {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ---------- статусы «важно» и «срочно» ---------- */

.flags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.switch-important input:checked + .switch-box {
  background: linear-gradient(135deg, #8b78e8, #6f5bd1);
  box-shadow: 0 2px 8px rgba(124, 92, 255, 0.28);
}

.switch-urgent input:checked + .switch-box {
  background: linear-gradient(135deg, #cf7d78, #b85c57);
  box-shadow: 0 2px 8px rgba(217, 83, 79, 0.24);
}

.modal-meta {
  margin: 2px 0 16px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  display: grid;
  gap: 3px;
}

.modal-meta-row strong {
  color: var(--text-soft);
  font-weight: 600;
}

.placement {
  display: flex;
  align-items: center;
  gap: 6px;
}

.placement::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

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

.modal-actions .spacer {
  flex: 1;
}

/* ---------- уведомление ---------- */

/* ---------- предпросмотр файла ---------- */

.preview-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 8, 14, 0.65);
  backdrop-filter: blur(4px);
  animation: fade-in 0.15s ease;
}

.preview {
  display: flex;
  flex-direction: column;
  width: min(760px, 100%);
  max-height: min(82vh, 760px);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: var(--shadow-modal);
  overflow: hidden;
}

.preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex: none;
}

.preview-title-wrap {
  min-width: 0;
}

.preview-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-meta {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--text-muted);
}

.preview-body {
  flex: 1;
  min-height: 140px;
  padding: 14px 16px 18px;
  overflow: auto;
}

.preview-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-soft);
}

.preview-image {
  display: block;
  max-width: 100%;
  max-height: 62vh;
  margin: 0 auto;
  border-radius: 8px;
  background: var(--panel-soft);
}

.preview-frame {
  width: 100%;
  height: 62vh;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
}

.preview-media {
  display: block;
  width: 100%;
}

.preview-empty {
  padding: 32px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.preview-empty .attach-btn {
  margin-top: 12px;
}

.preview-note {
  margin: 10px 0 0;
  font-size: 11.5px;
  color: var(--text-muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(540px, calc(100vw - 32px));
  padding: 10px 10px 10px 15px;
  border-radius: 12px;
  background: #2a3547;
  border: 1px solid var(--border-strong);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
  color: #e9eef6;
  font-size: 13.5px;
  transform: translate(-50%, 14px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.toast-text {
  flex: 1;
  min-width: 0;
}

.toast-undo {
  flex: none;
  border: 0;
  background: rgba(99, 102, 241, 0.2);
  color: #c7c9ff;
  font-size: 13px;
  font-weight: 650;
  padding: 5px 11px;
  border-radius: 8px;
  cursor: pointer;
}

.toast-undo:hover {
  background: rgba(99, 102, 241, 0.34);
}

.ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ic svg {
  display: block;
}

.icon-btn:disabled {
  opacity: 0.3;
  cursor: default;
  background: transparent;
}

.icon-btn:disabled:hover {
  background: transparent;
  color: var(--text-soft);
}

.foot-note.is-warn {
  color: #f87171;
  font-weight: 600;
}

/* ---------- адаптивность ---------- */

@media (max-width: 1500px) {
  .board {
    gap: 8px;
  }

  .column {
    min-width: 195px;
  }
}

@media (max-width: 1200px) {
  .board {
    gap: 6px;
    padding: 0 12px 6px;
  }

  .column {
    min-width: 160px;
  }

  .col-head {
    padding: 10px 7px 7px 11px;
    gap: 6px;
    min-height: 50px;
  }

  .col-title {
    font-size: 12.5px;
  }

  .col-body {
    padding: 0 7px 7px;
  }

  .card {
    padding: 9px 9px 8px;
  }

  .card-title {
    font-size: 13.5px;
  }

  .badge {
    white-space: normal;
  }

  .card-foot {
    font-size: 11px;
  }
}

@media (max-width: 1080px) {
  .stats {
    display: none;
  }

  .search input {
    width: 130px;
  }

  .search:focus-within input {
    width: 170px;
  }
}

@media (max-width: 760px) {
  .app-bar {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px 8px;
  }

  .brand-date {
    display: none;
  }

  .toolbar {
    width: 100%;
    margin-left: 0;
  }

  .search {
    flex: 1;
  }

  .search input,
  .search:focus-within input {
    width: 100%;
  }

  .board {
    padding: 0 14px 6px;
    gap: 10px;
  }

  .column {
    min-width: 244px;
  }

  .hint {
    margin: 0 14px 10px;
    align-items: flex-start;
  }

  .app-foot {
    padding: 6px 14px 8px;
  }

  .foot-keys {
    display: none;
  }
}

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

@media (max-width: 1100px) {
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    flex: none;
  }

  .field-desc {
    flex: none;
  }

  .form-side .attachments-field {
    margin-top: 0;
  }

  .field-desc textarea {
    height: 260px;
    min-height: 260px;
  }

  .modal {
    height: auto;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
  }
}







/* ---------- облако ---------- */

.cloud-status {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.cloud-status.is-error {
  color: var(--danger);
}

.cloud-auth {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 8, 14, 0.72);
  backdrop-filter: blur(7px);
}

.cloud-auth-card {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: var(--shadow-modal);
}

.cloud-auth-card h2 {
  margin: 0;
  font-size: 20px;
}

.cloud-auth-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.45;
}

.cloud-auth-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
}

.cloud-auth-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  outline: none;
}

.cloud-auth-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.cloud-auth-error {
  min-height: 18px;
  font-size: 12.5px;
  color: var(--danger);
}

.cloud-auth-card .btn {
  width: 100%;
  justify-content: center;
}
