/* Задачи по събитие (event-tasks.js): бутон в реда, панел „следващите 7 дни“, прозорец и шаблони. */
.ev-tasks-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 6px 12px 6px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-ink);
}
.ev-tasks-btn:hover {
  border-color: var(--gold);
  background: var(--cream);
}
.ev-tasks-btn.is-empty {
  padding-left: 12px;
  border-style: dashed;
  font-weight: 500;
  color: var(--ink-muted);
}
.ev-tasks-btn b {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--blush);
  font-size: 11px;
  color: var(--danger);
}
.ev-tasks-btn.has-late {
  border-color: #e3c9c0;
}
.ev-tasks-btn.is-done {
  color: var(--success);
}
/* Кръгче-прогрес: --p се задава от events.js. */
.ev-tasks-ring {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: conic-gradient(#3f8a55 var(--p, 0%), #eadfcb 0);
  -webkit-mask: radial-gradient(circle, transparent 4px, #000 4.5px);
  mask: radial-gradient(circle, transparent 4px, #000 4.5px);
}
/* Панел над списъка. */
.events-agenda details {
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 14px;
  background: #fff;
}
.events-agenda summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
}
.events-agenda summary::-webkit-details-marker {
  display: none;
}
.events-agenda summary strong {
  font:
    18px 'Lora', Georgia,
    serif;
  color: var(--ink);
}
.events-agenda summary strong::before {
  content: '▸';
  display: inline-block;
  margin-right: 8px;
  font-size: 13px;
  color: var(--gold-ink);
  transition: transform 0.15s;
}
.events-agenda details[open] summary strong::before {
  transform: rotate(90deg);
}
.events-agenda summary span {
  font-size: 13px;
  color: var(--ink-muted);
}
.events-agenda summary b {
  color: var(--danger);
}
.task-agenda {
  display: grid;
  margin: 0;
  padding: 0 18px 10px;
  list-style: none;
}
.task-agenda li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.task-agenda-main {
  display: grid;
  justify-items: start;
  gap: 2px;
  min-width: 0;
  padding: 2px 0;
  border: 0;
  background: none;
  text-align: left;
  font-weight: 400;
  color: inherit;
}
.task-agenda-main strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.task-agenda-main small {
  font-size: 12px;
  color: var(--ink-muted);
}
.task-agenda-main:hover strong {
  color: var(--gold-ink);
  text-decoration: underline;
}
/* Отметка и срок — общи за панела и прозореца. */
.task-check {
  display: grid;
  place-items: center;
  margin: 0;
}
.task-check input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--success);
  cursor: pointer;
}
.task-due {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--paper-sunk);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--gold-ink);
}
.task-due.overdue {
  background: var(--blush);
  color: var(--danger);
}
.task-due.today {
  background: #fbe9d4;
  color: #8a4f13;
}
.task-due.soon {
  background: #e3ecf5;
  color: #3c5a7a;
}
/* Прозорецът. */
.task-dialog {
  width: min(720px, 96vw);
  max-height: 92vh;
  padding: 22px 26px;
}
.task-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.task-head small {
  font-size: 11px;
  letter-spacing: 1.6px;
  color: var(--gold, var(--gold-ink));
}
.task-head h2 {
  margin: 4px 0 2px;
}
.task-head p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-muted);
}
.task-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 12px;
}
.task-progress span {
  flex: 1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--paper-sunk);
}
.task-progress b {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #3f8a55;
  transition: width 0.25s;
}
.task-progress small {
  font-size: 12px;
  white-space: nowrap;
  color: var(--ink-muted);
}
.task-template {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1.5px dashed var(--gold-line);
  border-radius: 12px;
  background: var(--cream);
}
.task-template div {
  display: grid;
  gap: 2px;
}
.task-template strong {
  font-size: 14px;
  color: var(--ink);
}
.task-template small {
  font-size: 12px;
  color: var(--ink-muted);
}
.task-template button {
  flex-shrink: 0;
  white-space: nowrap;
}
.task-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}
.task-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
}
.task-item .task-check {
  padding-top: 1px;
}
.task-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.task-body strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.task-body small {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  font-size: 12px;
  color: var(--ink-muted);
}
.task-body p {
  margin: 2px 0 0;
  font-size: 12px;
  white-space: pre-line;
  color: var(--ink-muted);
}
.task-item.is-done .task-body strong {
  font-weight: 500;
  text-decoration: line-through;
  color: var(--ink-muted);
}
.task-item.is-flash {
  border-radius: 10px;
  background: #fff6df;
  box-shadow: 0 0 0 2px var(--gold-line);
}
.task-edit {
  width: 34px;
  height: 34px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--ink-muted);
}
.task-edit:hover {
  border-color: var(--line);
  background: #fff;
}
.task-empty {
  padding: 14px 4px;
  font-size: 13px;
  color: #3f6b48;
}
.task-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 190px auto;
  gap: 8px;
  align-items: center;
}
.task-form input,
.task-form textarea {
  margin: 0;
  padding: 9px 10px;
  font-size: 13px;
}
.task-form textarea {
  grid-column: 1 / -1;
}
.task-add {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--cream);
}
.task-add button {
  white-space: nowrap;
}
.task-item.is-editing {
  display: block;
  padding: 10px;
  border-radius: 12px;
  background: var(--cream);
}
.task-item.is-editing .task-form {
  grid-template-columns: minmax(0, 1fr) 150px 190px;
}
.task-form-actions {
  display: flex;
  grid-column: 1 / -1;
  justify-content: flex-end;
  gap: 8px;
}
.task-form-actions .ev-danger {
  margin-right: auto;
}
.task-done-list {
  margin-top: 14px;
}
.task-done-list summary {
  padding: 6px 0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-muted);
}
.task-msg:empty {
  display: none;
}
.task-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
/* Настройки → Шаблони за задачи. */
.task-tpl-list {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
  padding: 0 0 0 26px;
}
.task-tpl-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}
.task-tpl-list li::marker {
  font-size: 12px;
  color: var(--ink-muted);
}
.task-tpl-list input {
  margin: 0;
}
.task-tpl-days {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 12px;
  white-space: nowrap;
  color: var(--ink-muted);
}
.task-tpl-days input {
  width: 76px;
  text-align: right;
}
.task-tpl-days span {
  width: 64px;
}
#task-templates-settings > .dashed {
  padding: 8px 14px;
  border-style: dashed;
  background: transparent;
  font-size: 13px;
}
@media (max-width: 760px) {
  .task-dialog {
    padding: 18px 16px;
  }
  .task-form,
  .task-item.is-editing .task-form {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .task-form input[name='title'] {
    grid-column: 1 / -1;
  }
  .task-add button {
    grid-column: 1 / -1;
  }
  .task-template {
    flex-direction: column;
    align-items: stretch;
  }
  .task-agenda {
    padding: 0 14px 8px;
  }
  .events-agenda summary {
    padding: 12px 14px;
  }
  .events-agenda summary strong {
    font-size: 16px;
  }
  .events-agenda summary span {
    white-space: nowrap;
  }
  .task-agenda li {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .task-agenda li .task-due {
    grid-column: 2;
    justify-self: start;
  }
  .task-tpl-list {
    padding-left: 20px;
  }
  .task-tpl-list li {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .task-tpl-list li input[data-tt-title] {
    grid-column: 1 / -1;
  }
}
/* Панелите в Настройки дават отстъпи на label/button — в реда на шаблона не трябват. */
#task-templates-settings .task-tpl-list label,
#task-templates-settings .task-tpl-list button {
  margin: 0;
}
