/* Задачи (v4): строки задач, кнопки и панель «Перенести», форма «Добавить задачу», чипы задач в сетке календаря,
   перетаскивание, сообщение внизу экрана. Цвета из tokens.css: «риск» = --bad, «внимание» = --warn. */

/* строка задачи в списках и карточке */
.task-item.overdue, .ag-task.overdue, .list li.overdue { box-shadow: inset 3px 0 0 var(--bad); }
.t-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1) var(--s2); }
.t-head b { font-weight: 600; overflow-wrap: anywhere; }
.t-actions { display: grid; gap: var(--s2); margin-top: var(--s1); min-width: 0; }
.t-slot:empty { display: none; }
.t-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 2px; }
.pill.repeat svg { width: 12px; height: 12px; flex: none; }
.card-tasks { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.head-counts { display: inline-flex; align-items: baseline; gap: var(--s2); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 500; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px; line-height: inherit; }
.link-btn:hover { filter: none; text-decoration-thickness: 2px; }

/* «Дела на сегодня»: у строки задачи кнопка «Перенести» справа, панель переноса ниже на всю ширину */
.list li.has-move { flex-wrap: wrap; }
.list li.has-move .t-actions { display: contents; }
.list li.has-move .t-slot { flex: 1 1 100%; cursor: default; }
.list li.nolink { cursor: default; }
.list li.nolink:hover { background: transparent; }

/* панель «Перенести» */
.move-form { gap: var(--s2); }
.move-title { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.move-quick { display: flex; flex-wrap: wrap; gap: var(--s2); }

/* форма «Добавить задачу» */
.task-form .form-title { font-weight: 600; color: var(--ink); }
.form input[type="search"] { width: 100%; }
.form fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.form legend { font-size: var(--t-sm); color: var(--muted); padding: 0; margin-bottom: var(--s1); }
.wd-pick { display: flex; flex-wrap: wrap; gap: var(--s1); }
.wd-pick legend { flex: 1 1 100%; }
.form .wd-pick label { display: inline-flex; grid-auto-flow: column; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 3px 10px; color: var(--ink); background: var(--surface); cursor: pointer; min-height: 32px; }
.wd-pick label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }
.wd-pick input { margin: 0; }
.fgroup { display: grid; gap: var(--s1); }
.flabel { font-size: var(--t-sm); color: var(--muted); }
.pick-row { display: flex; gap: var(--s2); }
.pick-row input { flex: 1; min-width: 0; }
.pick-chosen { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); color: var(--ink); }
.pick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.pick-btn { width: 100%; text-align: left; background: var(--surface); color: var(--ink); border: 1px solid var(--line); display: grid; gap: 0;
  font-weight: 400; padding: 6px 10px; }
.pick-btn:hover { background: var(--line-soft); filter: none; }
.pick-btn b { font-weight: 600; }
.pick-btn small { color: var(--muted); font-size: var(--t-xs); }

/* панель дня: эфиры и задачи по времени */
.day-tools { justify-content: flex-end; }
.day-form > .task-form-wrap, .day-form > .form { margin: 0 var(--s4); }
.ag-sub { padding: var(--s2) var(--s4) 2px; color: var(--muted); font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.ev-list li.ag-task, .ev-list li.ag-event { gap: var(--s1); }
.ag-task .ev-line b, .ag-event .ev-line b { overflow-wrap: anywhere; }
.ag-task .t-meta, .ag-task .pills, .ag-task .t-actions { padding-left: 16px; }

/* чипы задач в сетке месяца и недели */
.cline.tchip { align-items: flex-start; border-radius: 4px; }
.cline.tchip .cdot { margin-top: 4px; }
.cline.tchip .ctext { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.cal-grid.week .cline.tchip .ctext { -webkit-line-clamp: 4; }
.cline.tchip .ctime { font-weight: 600; }
.cline.tchip .crep { width: 11px; height: 11px; flex: none; margin-top: 2px; color: var(--muted); }
.cline.tchip.risk { color: var(--bad); }
.cline.tchip.risk .cdot { background: var(--bad); }
.cline.tchip.warn .cdot { background: var(--warn); }
.cline.tchip.warn .ctime { color: var(--warn); }
.cline.tchip[draggable="true"] { cursor: grab; }
.cline.tchip[draggable="true"]:hover { background: var(--line-soft); }
.cline.tchip.dragging { opacity: .4; }
.cline.tchip.pending { opacity: .6; }
.cal-grid.dragging .cal-cell.past { opacity: .5; }
.cal-grid.dragging .cal-cell:not(.past) { cursor: copy; }
.cal-cell.drop-ok { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }

/* сообщение внизу экрана */
.toast-zone { position: fixed; left: 50%; bottom: var(--s5); transform: translateX(-50%); z-index: 40; width: min(560px, calc(100vw - 32px));
  display: grid; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: var(--s2); background: var(--ink); color: var(--bg); border-radius: var(--r-md);
  padding: var(--s2) var(--s2) var(--s2) var(--s4); box-shadow: var(--shadow-2); font-size: var(--t-md); line-height: 1.45; max-width: 100%; }
.toast span { padding-top: 3px; overflow-wrap: anywhere; }
.toast.bad { background: var(--bad); color: #fff; }
.toast-x { background: transparent; color: inherit; padding: 4px; border: 0; display: inline-grid; place-items: center; flex: none; opacity: .8; }
.toast-x:hover { filter: none; opacity: 1; }
.toast-x svg { width: 16px; height: 16px; }
:root[data-theme="dark"] .toast.bad { color: #1b1d1e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast.bad { color: #1b1d1e; } }

@media (max-width: 760px) {
  .toast-zone { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .day-tools { justify-content: flex-start; }
  .pick-row { flex-wrap: wrap; }
}

/* строка в панели дня: значок, время и текст в одну строку, длинный текст переносится внутри себя */
.ag-line { display: flex; align-items: flex-start; gap: var(--s2); min-width: 0; }
.ag-line .cdot { margin-top: 7px; }
.ag-line .ev-time { flex: none; white-space: nowrap; padding-top: 1px; }
.ag-line b { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.ag-line .pill { flex: none; }
.cline.tchip .ctime { white-space: nowrap; }
.hint:empty { display: none; }
.task-form .form-row, .move-form .form-row { align-items: end; }
.t-actions button[aria-expanded="true"], .day-tools button.ghost[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.cline.tchip .ctext .crep { display: inline-block; vertical-align: -1px; margin: 0 3px 0 0; }
.stop-q { font-weight: 600; color: var(--ink); }
