#section-tasks {
  --tsk-line: color-mix(in srgb, var(--s2) 85%, var(--s3));
  --tsk-accent: var(--red-soft);
  --tsk-shadow: 0 2px 6px #10193305, 0 18px 40px -30px #21305245;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  color: var(--text);
  background: radial-gradient(ellipse at 68% 0, var(--accent-light), transparent 58%) var(--bg);
}

[data-theme="dark"] #section-tasks {
  --tsk-shadow: 0 2px 6px #0002, 0 18px 40px -30px #0009;
  color-scheme: dark;
}

.tsk-page {
  width: min(100%, 1152px);
  margin: 0 auto;
  padding: clamp(18px, 3.2vw, 40px);
}

.tsk-header, .tsk-board-head, .tsk-editor-head, .tsk-editor-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tsk-header { margin-bottom: 22px; }
.tsk-header h1 { margin: 0; font-size: clamp(29px, 4vw, 40px); font-weight: 780; letter-spacing: -.045em; line-height: 1.08; }
.tsk-header p { margin: 7px 0 0; color: var(--muted2); font-size: 13px; font-weight: 550; }
.tsk-header p::first-letter { text-transform: uppercase; }
#tsk-new { min-height: 44px; padding-inline: 16px; }
#tsk-new span { font-size: 20px; font-weight: 500; line-height: 1; }

.tsk-overview { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(240px, 1fr); gap: 16px; margin-bottom: 18px; }
.tsk-day-card, .tsk-deadlines, .tsk-board {
  min-width: 0;
  border: 1px solid var(--tsk-line);
  border-radius: 20px;
  background: var(--white);
  box-shadow: var(--tsk-shadow);
}

.tsk-day-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 21px 26px;
  border-color: #363673;
  background:
    radial-gradient(ellipse at 78% -30%, #6555bf 0, transparent 62%),
    linear-gradient(117deg, #1d2852, #312967);
  color: #fff;
}
.tsk-day-info { min-width: 0; }
.tsk-day-card h2, .tsk-deadlines h2 { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.25; }
.tsk-day-stats { display: flex; flex-wrap: wrap; column-gap: clamp(20px, 4vw, 44px); row-gap: 8px; margin-top: 13px; }
.tsk-day-stats > div { display: grid; gap: 3px; }
.tsk-day-stats strong { font-size: 30px; font-weight: 760; line-height: 1; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.tsk-day-stats span { color: #dee2ff; font-size: 12px; }
.tsk-progress {
  display: grid;
  place-items: center;
  position: relative;
  isolation: isolate;
  width: clamp(74px, 9.5vw, 104px);
  aspect-ratio: 1;
  flex: none;
  border-radius: 50%;
  background: conic-gradient(#cabdff var(--tsk-progress-value, 0%), #ffffff32 0);
  font-size: clamp(17px, 2.2vw, 23px);
  font-weight: 730;
  font-variant-numeric: tabular-nums;
}
.tsk-progress::before { content: ''; position: absolute; inset: 6px; z-index: -1; border-radius: inherit; background: #38306b; }

.tsk-deadlines { display: grid; gap: 5px; align-content: center; padding: 14px 16px 12px; }
.tsk-deadlines h2 { margin: 0 4px 3px; }
.tsk-deadlines button {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto 10px;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 5px 8px 5px 4px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: 650 13px var(--font-body);
  cursor: pointer;
}
.tsk-deadlines button:hover { background: var(--s1); }
.tsk-deadlines button[aria-pressed="true"] { border-color: var(--border2); background: var(--accent-light); }
.tsk-deadlines b { font-size: 15px; font-variant-numeric: tabular-nums; }
.tsk-deadline-icon, .tsk-editor-heading > span, .tsk-product-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  background: var(--accent-light);
  color: var(--tsk-accent);
  font-size: 17px;
  font-weight: 700;
}
.tsk-deadline-icon.tsk-deadline-late { background: #f2455f18; color: #b83048; }
.tsk-chevron { display: inline-block; flex: none; width: 6px; height: 6px; margin-right: 2px; border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor; transform: rotate(45deg); color: var(--muted2); }

.tsk-board { min-height: 360px; }
.tsk-views { display: flex; gap: 5px; overflow-x: auto; padding: 10px 15px; border-bottom: 1px solid var(--s2); scrollbar-width: thin; }
.tsk-views button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  min-height: 36px;
  padding: 6px 11px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted2);
  font: 650 13px var(--font-body);
  cursor: pointer;
  white-space: nowrap;
}
.tsk-views button b {
  min-width: 20px;
  padding: 2px 5px;
  border-radius: 6px;
  background: var(--s1);
  color: inherit;
  font-size: 11px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.tsk-views button:hover { background: var(--s1); color: var(--text); }
.tsk-views button[aria-pressed="true"] { color: var(--tsk-accent); background: var(--accent-light); }
.tsk-views button[aria-pressed="true"] b { background: var(--white); }

.tsk-board-body { padding: clamp(13px, 2.5vw, 23px); }
.tsk-board-head h2, .tsk-editor-head h2 { margin: 0; font-size: 21px; font-weight: 750; line-height: 1.15; letter-spacing: -.025em; }
.tsk-search { position: relative; width: min(100%, 275px); }
.tsk-search-icon { display: inline-block; position: relative; width: 13px; height: 13px; border: 1.5px solid currentColor; border-radius: 50%; }
.tsk-search-icon::after { content: ''; position: absolute; right: -4px; bottom: -2px; width: 5px; height: 1.5px; background: currentColor; transform: rotate(45deg); }
.tsk-search .tsk-search-icon { position: absolute; left: 12px; top: 12px; color: var(--muted2); pointer-events: none; }

.tsk-quick { margin: 15px 0 2px; border: 1px solid var(--tsk-line); border-radius: 13px; background: var(--s1); }
.tsk-quick:focus-within { border-color: var(--border2); }
.tsk-quick-main, .tsk-quick-tools { display: flex; align-items: center; gap: 7px; padding: 6px 7px 6px 12px; }
.tsk-quick-plus { color: var(--tsk-accent); font-size: 23px; line-height: 1; }
.tsk-quick-tools { padding-top: 0; padding-bottom: 8px; flex-wrap: wrap; }
.tsk-quick-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  min-height: 28px;
  border: 1px solid var(--tsk-line);
  border-radius: 8px;
  background: var(--white);
  color: var(--muted2);
  font: 650 12px var(--font-body);
  cursor: pointer;
}
.tsk-quick-tag span:first-child { color: var(--tsk-accent); }
.tsk-quick-tag:hover { color: var(--tsk-accent); border-color: var(--border2); }

#section-tasks [hidden] { display: none !important; }
#section-tasks input:not([type="checkbox"]), #section-tasks textarea, #section-tasks select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--tsk-line);
  border-radius: 9px;
  background: var(--s1);
  color: var(--text);
  font: 450 14px var(--font-body);
}
#section-tasks input::placeholder, #section-tasks textarea::placeholder { color: var(--muted2); opacity: .8; }
#section-tasks textarea { resize: vertical; }
#section-tasks :is(button, input, select, textarea, a):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#section-tasks .tsk-search input { padding-left: 33px; }
#section-tasks .tsk-quick-main input { min-height: 36px; border: 0; background: transparent; padding-left: 3px; }
#section-tasks .tsk-quick-main input:focus-visible { outline: none; }

.tsk-button, .tsk-icon-button, .tsk-delete, .tsk-date-buttons button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--tsk-line);
  border-radius: 9px;
  background: var(--white);
  color: var(--text);
  font: 650 13px var(--font-body);
  cursor: pointer;
}
.tsk-button:hover, .tsk-icon-button:hover, .tsk-date-buttons button:hover { background: var(--s1); }
#section-tasks button:disabled { opacity: .58; cursor: default; }
.tsk-primary, .tsk-primary:hover { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 4px 12px -5px var(--accent); }
.tsk-primary:hover { filter: brightness(1.09); }
.tsk-quick-submit, .tsk-quick-submit:hover { background: var(--accent-light); color: var(--tsk-accent); border-color: transparent; }
.tsk-quick-submit:hover { border-color: var(--border2); }
.tsk-icon-button { width: 34px; min-height: 34px; padding: 0; font-size: 22px; background: transparent; }

.tsk-group-title { display: flex; align-items: center; gap: 10px; margin: 19px 0 7px; color: var(--muted2); font-size: 12px; font-weight: 750; }
.tsk-group-title::after { content: ''; height: 1px; flex: 1; background: var(--s2); }
.tsk-rows { margin-top: 8px; }
.tsk-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: start;
  padding: 10px 8px;
  border: 1px solid transparent;
  border-radius: 11px;
}
.tsk-row:hover, .tsk-row:focus-within { border-color: var(--s2); background: var(--s1); }
.tsk-toggle {
  position: relative;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin: 4px auto;
  padding: 0;
  border: 1.5px solid var(--s3);
  border-radius: 50%;
  background: var(--white);
  color: var(--tsk-accent);
  font: 750 13px var(--font-body);
  cursor: pointer;
}
.tsk-toggle::before { content: ''; position: absolute; inset: -6px; }
.tsk-toggle span { opacity: 0; }
.tsk-toggle:hover, .tsk-toggle[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-light); }
.tsk-toggle:hover span, .tsk-toggle:focus-visible span, .tsk-toggle[aria-pressed="true"] span { opacity: 1; }
.tsk-title {
  max-width: 100%;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--text);
  text-align: left;
  overflow-wrap: anywhere;
  font: 700 15px/1.45 var(--font-body);
  cursor: pointer;
}
.tsk-title:hover { color: var(--tsk-accent); }
.tsk-completed .tsk-title { text-decoration: line-through; color: var(--muted2); }
.tsk-notes-preview { overflow: hidden; margin: 1px 0 3px; color: var(--muted2); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.tsk-row-edit { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 6px; border: 0; border-radius: 6px; background: none; color: var(--muted2); font: 650 12px var(--font-body); cursor: pointer; }
.tsk-row-edit:hover { background: var(--accent-light); color: var(--tsk-accent); }
.tsk-meta-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.tsk-meta {
  min-width: 0;
  max-width: 100%;
  padding: 3px 7px;
  border: 1px solid var(--s2);
  border-radius: 6px;
  background: var(--white);
  color: var(--muted2);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.tsk-article { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.tsk-article a { color: var(--tsk-accent); text-decoration: none; font-weight: 700; }
.tsk-article a:hover { text-decoration: underline; }
.tsk-article-mark { color: var(--tsk-accent); font-weight: 700; }
.tsk-shop { color: var(--muted2); }
.tsk-shop::before { content: '·'; margin-right: 5px; }
.tsk-late, .tsk-priority-2, .tsk-error, .tsk-delete { color: #b83048; }
.tsk-priority-1 { color: #8c5106; }
[data-theme="dark"] :is(.tsk-late, .tsk-priority-2, .tsk-error, .tsk-delete, .tsk-deadline-icon.tsk-deadline-late) { color: #ff9aab; }
[data-theme="dark"] .tsk-priority-1 { color: #ffd291; }
.tsk-empty {
  display: grid;
  justify-items: center;
  padding: 27px 10px 12px;
  text-align: center;
  color: var(--muted2);
}
.tsk-empty-mark { display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 11px; border-radius: 14px; background: var(--accent-light); color: var(--tsk-accent); font-size: 24px; }
.tsk-empty h3 { margin: 0; color: var(--text); font-size: 15px; font-weight: 740; }
.tsk-empty p { max-width: 350px; margin: 5px 0 0; font-size: 13px; line-height: 1.42; }
.tsk-empty button { margin-top: 9px; }
.tsk-status { padding: 14px 0; color: var(--muted2); font-size: 13px; }

#tsk-editor {
  width: min(580px, calc(100vw - 24px));
  height: fit-content;
  max-height: min(780px, calc(100dvh - 24px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--tsk-line);
  border-radius: 20px;
  background: var(--white);
  color: var(--text);
  box-shadow: 0 24px 70px #080f2652;
}
#tsk-editor::backdrop { background: #11193488; }
.tsk-editor-form { display: flex; flex-direction: column; max-height: inherit; }
.tsk-editor-head, .tsk-editor-foot { flex-shrink: 0; padding: 13px 20px; }
.tsk-editor-head { border-bottom: 1px solid var(--s2); }
.tsk-editor-heading { display: flex; align-items: center; gap: 10px; }
.tsk-editor-heading > span { width: 34px; height: 34px; flex: none; }
.tsk-editor-foot { border-top: 1px solid var(--s2); justify-content: flex-end; background: var(--s1); }
.tsk-editor-body { display: grid; gap: 15px; overflow-y: auto; padding: 17px 20px; }
.tsk-editor-body label, .tsk-field-title { display: grid; gap: 6px; min-width: 0; font-size: 13px; font-weight: 700; }
.tsk-field-title { margin-bottom: 6px; }
.tsk-field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.tsk-date-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -6px; }
.tsk-date-buttons button { min-height: 28px; padding: 3px 8px; font-size: 12px; }
.tsk-date-buttons button[aria-pressed="true"] { background: var(--accent-light); border-color: var(--border2); color: var(--tsk-accent); }

#tsk-product-picker { display: grid; gap: 7px; margin-top: 8px; }
#tsk-product-picker label { display: block; }
#tsk-product-picker input { margin-top: 5px; }
#tsk-product-results { display: grid; gap: 4px; max-height: 190px; overflow: auto; font-size: 13px; }
.tsk-picker-status { margin: 4px; color: var(--muted2); }
.tsk-selected-product, .tsk-product-option, .tsk-product-pick {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--tsk-line);
  border-radius: 10px;
  background: var(--s1);
  color: var(--text);
  font: 450 13px var(--font-body);
  overflow-wrap: anywhere;
}
.tsk-selected-product { justify-content: space-between; }
.tsk-selected-product div { display: grid; gap: 2px; min-width: 0; }
.tsk-selected-product small, .tsk-product-option span { color: var(--muted2); }
.tsk-selected-product button { flex: none; }
.tsk-product-option { flex-wrap: wrap; justify-content: flex-start; text-align: left; cursor: pointer; }
.tsk-product-pick { width: 100%; text-align: left; cursor: pointer; }
.tsk-product-pick .tsk-chevron { margin-left: auto; }
.tsk-product-pick:hover, .tsk-product-option:hover { background: var(--accent-light); border-color: var(--border2); }
.tsk-step { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.tsk-step input[type="checkbox"] { width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.tsk-step button { flex: none; }
.tsk-error { font-size: 13px; font-weight: 650; }
.tsk-delete { margin-right: auto; border-color: transparent; background: transparent; }
.tsk-delete:hover { text-decoration: underline; }

@media (max-width: 720px) {
  .tsk-overview { grid-template-columns: minmax(0, 1.2fr) minmax(195px, 1fr); gap: 10px; margin-bottom: 12px; }
  .tsk-day-card { padding: 14px; }
  .tsk-deadlines { padding: 9px; }
  .tsk-header { margin-bottom: 14px; }
}

@media (max-width: 510px) {
  .tsk-page { padding: 12px; }
  .tsk-header h1 { font-size: 29px; }
  #tsk-new { min-height: 40px; padding-inline: 10px; }
  .tsk-overview { grid-template-columns: minmax(0, 1fr); }
  .tsk-deadlines { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tsk-deadlines h2 { grid-column: 1 / -1; }
  .tsk-deadlines button { grid-template-columns: 23px minmax(0, 1fr) auto; gap: 5px; padding-right: 4px; font-size: 12px; }
  .tsk-deadlines button .tsk-chevron { display: none; }
  .tsk-deadline-icon { width: 23px; height: 23px; }
  .tsk-board-head { align-items: stretch; flex-direction: column; gap: 9px; }
  .tsk-search { width: 100%; }
  .tsk-views { flex-wrap: wrap; padding: 8px; }
  .tsk-views button { min-height: 34px; padding-inline: 8px; }
  .tsk-editor-head, .tsk-editor-foot, .tsk-editor-body { padding-inline: 13px; }
  .tsk-row-edit span { display: none; }
}
