/* =============================================================================
   Раздел «Дела»: задачи, заметки, память, карточка проекта.

   Опирается на токены панели (--ink, --muted, --line, --violet, --ease) и на её
   готовые классы .panel / .metrics / .section-head — отдельной темы здесь нет,
   иначе раздел выглядел бы гостем в собственной панели.
   ============================================================================= */

.hub-layout { display: grid; gap: 18px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 1180px) { .hub-layout { grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); } }

.hub-panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.hub-panel > header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.hub-panel > header h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--ink); }
.hub-panel > header small { display: block; margin-top: 2px; font-size: 11px; letter-spacing: .14em; color: var(--muted); }
.hub-panel-body { padding: 14px 18px 18px; }

/* ── Фильтры ───────────────────────────────────────────────────────────────
   Кнопки-переключатели, а не выпадающий список: вариантов пять, и при
   переключении видно, сколько задач в каждом срезе. */
.hub-filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: #fafbfd; }
.hub-chip {
  min-height: 34px; padding: 0 13px; display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer;
  font: inherit; font-size: 13px; color: var(--ink); transition: border-color var(--ease), color var(--ease), background var(--ease);
}
.hub-chip:hover { border-color: #c9ccd8; }
.hub-chip.active { border-color: var(--violet); color: var(--violet); background: #f2f0ff; font-weight: 600; }
.hub-chip b { font-variant-numeric: tabular-nums; font-weight: 700; }
.hub-chip.danger.active { border-color: #d64545; color: #d64545; background: #fdf1f1; }

/* ── Форма добавления ─────────────────────────────────────────────────────── */
.hub-add { display: grid; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.hub-add-row { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .hub-add-row { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; } }
.hub-field { display: grid; gap: 5px; min-width: 0; }
.hub-field > span { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.hub-field input, .hub-field select, .hub-field textarea {
  min-height: 42px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); font: inherit; font-size: 14px;
}
.hub-field textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.hub-field input:focus-visible, .hub-field select:focus-visible, .hub-field textarea:focus-visible,
.hub-chip:focus-visible, .hub-btn:focus-visible, .hub-task-check:focus-visible {
  outline: 2px solid var(--violet); outline-offset: 2px;
}
.hub-btn {
  min-height: 42px; padding: 0 18px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--violet); color: #fff; font: inherit; font-size: 14px; font-weight: 600;
  transition: background var(--ease), opacity var(--ease);
}
.hub-btn:hover { background: #5448e0; }
.hub-btn[disabled] { opacity: .5; cursor: not-allowed; }
.hub-btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.hub-btn.ghost:hover { border-color: #c9ccd8; background: #fafbfd; }
.hub-btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; }

/* ── Задачи ───────────────────────────────────────────────────────────────── */
.hub-list { display: flex; flex-direction: column; }
.hub-task {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start;
  padding: 13px 18px; border-bottom: 1px solid var(--line);
}
.hub-task:last-child { border-bottom: 0; }
.hub-task:hover { background: #fafbfd; }
/* Цель нажатия 44×44 при кружке 20px: попасть в чекбокс мышью и пальцем
   одинаково легко, а рамка остаётся аккуратной. */
.hub-task-check {
  width: 44px; height: 44px; margin: -11px 0 0 -12px; display: grid; place-items: center;
  border: 0; background: none; cursor: pointer;
}
.hub-task-check i {
  width: 20px; height: 20px; border: 2px solid #c3c8d6; border-radius: 50%;
  display: grid; place-items: center; transition: border-color var(--ease), background var(--ease);
}
.hub-task-check:hover i { border-color: var(--violet); }
.hub-task.done .hub-task-check i { background: var(--violet); border-color: var(--violet); }
.hub-task.done .hub-task-check i::after { content: ''; width: 9px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -1px); }
.hub-task.done .hub-task-title { color: var(--muted); text-decoration: line-through; }
.hub-task-title { font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.4; word-break: break-word; }
.hub-task-details { margin-top: 3px; font-size: 13px; color: var(--muted); line-height: 1.5; white-space: pre-wrap; }
.hub-task-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; align-items: center; }
.hub-task-actions { display: flex; gap: 6px; }

/* Срок: цветом И словом — «просрочено» должно читаться и без цвета. */
.hub-due { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hub-due.overdue { color: #c23434; font-weight: 600; }
.hub-due.today { color: #a96410; font-weight: 600; }
.hub-tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; background: #f1f2f7; font-size: 12px; color: #4a5164; }
.hub-tag i { width: 7px; height: 7px; border-radius: 50%; background: var(--violet); }
.hub-prio { font-size: 12px; color: var(--muted); }
.hub-prio.p1 { color: #c23434; font-weight: 600; }

/* ── Заметки и память ─────────────────────────────────────────────────────── */
.hub-note { padding: 13px 18px; border-bottom: 1px solid var(--line); }
.hub-note:last-child { border-bottom: 0; }
.hub-note b { display: block; font-size: 14px; color: var(--ink); }
.hub-note p { margin: 4px 0 0; font-size: 13px; line-height: 1.55; color: #4a5164; white-space: pre-wrap; }
.hub-note-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.hub-note-meta time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.hub-memory-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 11px 18px; border-bottom: 1px solid var(--line); }
.hub-memory-row:last-child { border-bottom: 0; }
.hub-memory-row b { font-size: 13px; color: var(--ink); }
.hub-memory-row span { display: block; margin-top: 2px; font-size: 13px; color: #4a5164; line-height: 1.5; word-break: break-word; }

/* ── Карточка проекта ─────────────────────────────────────────────────────── */
.hub-card-head { display: grid; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
@media (min-width: 720px) { .hub-card-head { grid-template-columns: minmax(0, 1fr) auto; align-items: center; } }
.hub-card-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hub-card-mark { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 16px; }
.hub-card-title h3 { margin: 0; font-size: 17px; }
.hub-card-title a { font-size: 13px; color: var(--violet); text-decoration: none; }
.hub-card-title a:hover { text-decoration: underline; }
.hub-card-stats { display: flex; flex-wrap: wrap; gap: 18px; }
.hub-card-stats div { min-width: 74px; }
.hub-card-stats b { display: block; font-size: 19px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.hub-card-stats span { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.hub-status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.hub-status i { width: 8px; height: 8px; border-radius: 50%; background: #2f9e6b; }
.hub-status.down i { background: #c23434; }
.hub-status.unknown i { background: #b6bac6; }

.hub-empty { padding: 26px 18px; text-align: center; color: var(--muted); font-size: 13px; }
.hub-skeleton { height: 58px; margin: 12px 18px; border-radius: 10px; background: linear-gradient(90deg, #f1f2f7 25%, #e7e9f0 37%, #f1f2f7 63%); background-size: 400% 100%; animation: hub-shimmer 1.3s ease-in-out infinite; }
@keyframes hub-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .hub-skeleton { animation: none; } }

/* Плитки сводки: тот же .metric, что на «Обзоре», плюс состояние «есть
   просроченное» — цветом и словом «Просрочено», не только цветом. */
.hub-metric { cursor: default; }
.hub-metric[role="button"] { cursor: pointer; transition: border-color var(--ease), transform var(--ease); }
.hub-metric[role="button"]:hover { border-color: var(--violet); }
.hub-metric[role="button"]:active { transform: translateY(1px); }
.hub-metric[role="button"]:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.hub-metric.danger b { color: #c23434; }
.hub-metric.danger { border-color: #f0c9c9; background: #fffafa; }
@media (prefers-reduced-motion: reduce) { .hub-metric[role="button"] { transition: none; } }
