/* Звіт про виконані роботи: стилі шаблону. Звіт — одна безперервна сторінка завширшки A4;
   report.js після рендеру задає висоту сторінки для друку (@page). */

@font-face {
  font-family: 'Manrope';
  src: url('assets/fonts/manrope-variable.ttf') format('truetype');
  font-weight: 200 800;
  font-display: block;
}

:root {
  --ink: #211951;
  --ink-2: #433c68;
  --muted: #6e6888;
  --faint: #a29cb6;
  --line: #efecf5;
  --line-strong: #e4dfee;
  --card-line: #ece8f4;
  --canvas: #f6eef7;
  --pink: #cf4fa7;
  --pink-soft: #fcebf6;
  --grad: linear-gradient(100deg, #cd5cba 0%, #a76dd0 50%, #768de7 100%);
}

* { box-sizing: border-box; }

html { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

body {
  margin: 0;
  background: #e7e3ef;
  color: var(--ink);
  font-family: 'Manrope', Arial, Helvetica, sans-serif;
  font-variant-ligatures: none;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Панель (лише на екрані) ---------- */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-strong);
  font-size: 13px;
}
.toolbar[hidden], .toolbar label[hidden] { display: none; }
.toolbar-title { font-weight: 800; }
.toolbar label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; }
.toolbar select {
  max-width: 340px;
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.toolbar .chips { display: inline-flex; align-items: center; gap: 6px; }
.toolbar .chips > span { margin-right: 2px; color: var(--muted); font-weight: 600; }
.toolbar .chips button {
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-2);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.toolbar .chips button:hover { border-color: #cdbff0; }
.toolbar .chips button[aria-pressed='true'] { border-color: var(--ink); background: var(--ink); color: #fff; }
.toolbar .print-button {
  margin-left: auto;
  padding: 9px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--grad);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.pages { display: flex; flex-direction: column; align-items: center; gap: 28px; padding: 28px 0 64px; }

/* ---------- Сторінка ---------- */

.page {
  position: relative;
  width: 210mm;
  display: flex;
  flex-direction: column;
  padding: 14px;
  overflow: hidden;
  background: var(--canvas);
  box-shadow: 0 10px 34px rgba(33, 25, 81, 0.14);
}

.page-body {
  position: relative;
  z-index: 1;
  flex: none;
  display: flex;
  flex-direction: column;
  margin: 0 14px;
  padding: 16px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #efeaf6;
  border-radius: 18px;
  box-shadow: 0 12px 32px rgba(45, 27, 105, 0.08);
}

.page-footer {
  position: relative;
  z-index: 1;
  flex: none;
  display: flex;
  justify-content: space-between;
  margin: 14px 30px 16px;
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.82);
}
.page-number { font-variant-numeric: tabular-nums; }

.blk { flex: none; }
.blk[data-space='xs'] { padding-top: 5px; }
.blk[data-space='s'] { padding-top: 8px; }
.blk[data-space='m'] { padding-top: 12px; }
.blk[data-space='l'] { padding-top: 18px; }
.page-body > .blk:first-child { padding-top: 0; }

.logo { display: block; width: auto; height: 30px; }
.sparkle, .icon { display: inline-block; flex: none; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Шапка ---------- */

.page-frame {
  position: absolute;
  inset: 14px;
  z-index: 0;
  border-radius: 26px;
  /* Теплий сливовий градієнт: зліва ліловий, справа глибокий. */
  background: linear-gradient(90deg, #8f5e98 0%, #7c4f8d 30%, #6a4282 55%, #563773 82%, #4b316b 100%);
}
.hero {
  position: relative;
  z-index: 1;
  flex: none;
  padding: 22px 30px 24px;
  color: #fff;
}
.hero-stars { position: absolute; right: 26px; top: 16px; }
.hero .hs { position: absolute; }
.hero .hs1 { right: 62px; top: 64px; }
.hero .hs2 { right: 40px; top: 36px; }
.hero .hs3 { left: 46%; top: 30px; opacity: 0.8; }
.hero > .logo { height: 26px; }
.hero-titles { margin: 16px 0 0; max-width: 70%; font-size: inherit; font-weight: inherit; white-space: pre-wrap; }
.hero-kicker, .hero-title { display: block; font-size: 26px; line-height: 1.18; font-weight: 800; letter-spacing: -0.005em; }
.hero-title { margin: 0; overflow: hidden; white-space: nowrap; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; max-width: 74%; margin-top: 14px; }
.chip-glass {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 12px 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.86);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}
.chip-glass b { color: #fff; font-weight: 700; }
.chip-glass .icon { opacity: 0.8; }

/* ---------- Смуга підсумку ---------- */

.summary-band { position: relative; overflow: hidden; padding: 13px 24px 15px; border-radius: 16px; background: var(--grad); color: #fff; }
.band-head { display: flex; align-items: center; }
.band-eyebrow { font-size: 11.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.band-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.72);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
}
.band-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) auto minmax(0, 1fr); align-items: center; gap: 0 22px; margin-top: 8px; }
.band-label { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.86; }
.band-total { display: block; margin-top: 2px; font-size: 40px; line-height: 1.05; font-weight: 800; letter-spacing: -0.02em; }
.band-sub { display: block; margin-top: 2px; font-size: 12px; font-weight: 600; opacity: 0.86; }
.band-sep { align-self: stretch; width: 1px; background: rgba(255, 255, 255, 0.4); }
.band-side { display: grid; gap: 10px; }
.band-stat { display: flex; align-items: center; gap: 12px; min-width: 0; }
.band-stat > div { min-width: 0; }
.band-stat b { display: block; margin-top: 1px; font-size: 22px; line-height: 1.15; font-weight: 800; white-space: nowrap; }
.band-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.17);
}
.summary-band .bs { position: absolute; opacity: 0.8; }
.summary-band .bs1 { right: 18px; bottom: 12px; }
.summary-band .bs2 { left: 36%; top: 15px; opacity: 0.6; }
.summary-band .bs3 { left: 52%; bottom: 12px; opacity: 0.6; }

/* ---------- Картки ---------- */

.card { padding: 14px 16px; border: 1px solid var(--card-line); border-radius: 14px; background: #fff; }
.card-head, .table-title { display: flex; align-items: center; gap: 11px; }
.card-head h2, .table-title h2 { margin: 0; font-size: 19px; line-height: 1.2; font-weight: 800; letter-spacing: -0.01em; }
.card-aside { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); }
.icon-tile { display: flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; border-radius: 10px; background: var(--pink-soft); color: var(--pink); }

.meter { position: relative; display: block; height: 6px; border-radius: 999px; background: #ebe8f2; overflow: hidden; }
.meter > i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; }

/* ---------- Куди пішов час: кільцева діаграма ---------- */

.time-body { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 32px; align-items: center; margin-top: 10px; padding-left: 8px; }
.ring { position: relative; }
.ring svg { display: block; overflow: visible; }
.ring-seg { stroke-width: 1.5; stroke-linejoin: round; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.ring-center b { font-size: 26px; line-height: 1; font-weight: 800; letter-spacing: -0.01em; }
.ring-center span { margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }

.legend-list { display: grid; }
.legend-row { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto 46px; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.legend-row:last-child { border-bottom: 0; }
.legend-main { min-width: 0; line-height: 1.3; }
.legend-main b { display: block; font-size: 13px; font-weight: 800; }
.legend-main small { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.legend-num { text-align: right; line-height: 1.3; }
.legend-num b { display: block; font-size: 13px; font-weight: 800; }
.legend-num small { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.legend-pct { text-align: right; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }

.weeks { margin-top: 10px; }
.week-cols { display: flex; align-items: flex-end; gap: 10px; height: 112px; padding-top: 4px; }
.week { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 0; }
.week b { margin-bottom: 3px; font-size: 11px; font-weight: 800; }
.week-bar { display: flex; flex-direction: column-reverse; width: 100%; max-width: 40px; border-radius: 6px 6px 2px 2px; overflow: hidden; }
.week-bar > i { display: block; flex-basis: 0; }
.week span { margin-top: 4px; font-size: 10px; line-height: 1.2; font-weight: 600; color: var(--muted); text-align: center; }

/* ---------- Напрями і задачі ---------- */

.section-title { display: flex; align-items: center; gap: 11px; }
.section-title h2 { margin: 0; font-size: 19px; line-height: 1.2; font-weight: 800; letter-spacing: -0.01em; }

.dir-columns {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 150px 84px 88px 16px;
  gap: 12px;
  padding: 0 14px 0 16px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}
.dir-columns span:nth-child(4), .dir-columns span:nth-child(5) { text-align: right; }
.share { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 8px; align-items: center; }
.share .meter { height: 8px; }
.task .share .meter { height: 6px; }
.share small { text-align: right; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.task .share small { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.dir-card { position: relative; border: 1px solid var(--card-line); border-radius: 14px; background: #fff; overflow: hidden; }
.dir-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.dir-head {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 150px 84px 88px 16px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px 12px 16px;
  cursor: pointer;
  user-select: none;
}
.dir-head:hover .dir-main b { color: #6a3fb0; }
.dir-mark { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 9px; }
.dir-main { min-width: 0; font-size: 13.5px; line-height: 1.35; }
.dir-main b { font-weight: 800; }
.dir-people { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.dir-title { margin: 0; font-size: inherit; font-weight: inherit; }
h4.task-title { margin: 0; }
/* Назви напрямів і задач стають закладками PDF: break-spaces зберігає пробіл на перенесенні рядка. */
h3.dir-title, h4.task-title { white-space: break-spaces; }
/* PDF «огляд + деталізація»: посилання з огляду до записів задачі й назад. */
.jump { color: var(--pink); font-weight: 700; text-decoration: none; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.dir-main small { display: block; margin-top: 3px; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.dir-hours, .dir-sum { text-align: right; }
.dir-hours b, .dir-sum b { display: block; font-size: 14px; font-weight: 800; }
.dir-hours small, .dir-sum small { display: block; margin-top: 2px; font-size: 11px; font-weight: 600; color: var(--muted); }
.chev { color: #b3abc6; transition: transform 0.15s ease; }
.is-open > .dir-head > .chev, .is-open > .task-head > .chev { transform: rotate(90deg); }

.dir-tasks { border-top: 1px solid var(--line); }
.task-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 84px 88px 16px;
  gap: 12px;
  align-items: center;
  padding: 8px 14px 8px 58px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
}
.task:last-child > .task-head { border-bottom: 0; }
.task.is-open:last-child > .task-head { border-bottom: 1px solid var(--line); }
.task-head:hover .task-title { color: #6a3fb0; }
.task-main { min-width: 0; line-height: 1.35; }
.task-title { display: block; font-size: 12.5px; font-weight: 650; }
.task-key { margin-right: 6px; font-size: 11px; font-weight: 800; color: var(--muted); text-decoration: none; }
.task-meta { display: block; margin-top: 1px; font-size: 11px; font-weight: 600; color: var(--muted); }
.task-hours { text-align: right; font-size: 12.5px; font-weight: 800; }
.task-sum { text-align: right; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }

/* У варіанті з кільцем у картках немає стовпця частки. */
.report[data-chart='ring'] .dir-head { grid-template-columns: 30px minmax(0, 1fr) 84px 88px 16px; }
.report[data-chart='ring'] .task-head { grid-template-columns: minmax(0, 1fr) 84px 88px 16px; }

/* Записи задачі — на найсвітлішому відтінку кольору свого напряму. */
.task-entries { background: var(--soft); border-bottom: 1px solid var(--line); }
.task:last-child .task-entries { border-bottom: 0; }
.task-entry { display: grid; grid-template-columns: minmax(0, 1fr) 64px; gap: 12px; padding: 6px 30px 6px 92px; border-bottom: 1px solid #f1eef6; font-size: 12px; color: var(--ink-2); }
.task-entry:last-child { border-bottom: 0; }
.task-entry.with-date { grid-template-columns: 44px minmax(0, 1fr) 64px; }
.te-date { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.te-text { white-space: pre-line; line-height: 1.45; }
.te-person { display: block; font-size: 11px; font-weight: 700; color: var(--muted); }
.te-hours { text-align: right; font-weight: 700; color: var(--ink); }

/* Варіант «кольоровий фон»: картка напряму на своєму відтінку, задачі й записи — блоки з проміжками замість ліній. */
.report[data-cards='tint'] .dir-card { border-color: transparent; background: var(--tint); }
.report[data-cards='tint'] .dir-card::before { display: none; }
.report[data-cards='tint'] .dir-mark { background: #fff !important; }
.report[data-cards='tint'] .dir-tasks { display: grid; gap: 6px; padding: 0 10px 10px; border-top: 0; }
.report[data-cards='tint'] .task { border-radius: 10px; background: #fff; overflow: hidden; }
.report[data-cards='tint'] .task-head,
.report[data-cards='tint'] .task.is-open:last-child > .task-head { padding: 8px 4px 8px 48px; border-bottom: 0; }
.report[data-cards='tint'] .task-entries { display: grid; gap: 4px; padding: 0 10px 10px; border-bottom: 0; background: none; }
.report[data-cards='tint'] .task-entry { padding: 7px 14px 7px 40px; border: 0; border-radius: 8px; background: var(--soft); }

/* ---------- Друк ---------- */

@page { margin: 0; }

@media print {
  body { background: none; }
  .toolbar, .screen-only { display: none; }
  .pages { display: block; padding: 0; }
  .page { box-shadow: none; break-after: page; }
  .page:last-child { break-after: auto; }
  .chev { visibility: hidden; }
  .dir-head, .task-head { cursor: default; }
}
