.week-screen { min-width: 0; container-type: inline-size; }
.week-screen > header { display: grid; gap: 7px; }
.week-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 9px; }
.week-title h2 { font-size: 1.4rem; line-height: 1.3; overflow-wrap: anywhere; }
.week-title > span { color: var(--muted); font-size: .86rem; }
.week-screen .panel { background: var(--surface); }
.week-section-tabs { margin-bottom: 2px; }
.week-screen .week-empty { padding: 2px 0 9px; color: var(--muted); }
.week-screen .week-table td { overflow-wrap: anywhere; }
.week-screen .week-table td:has(> .week-status) { white-space: nowrap; }
.week-screen .week-table a { font-weight: 650; text-underline-offset: 3px; }
.week-screen .week-table .button { font-weight: 600; }
.week-search input { min-width: min(100%, 190px); }

.week-stack { display: grid; align-content: start; gap: 12px; min-width: 0; }
.week-split { display: grid; align-items: start; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.week-props { display: grid; gap: 7px 14px; grid-template-columns: max-content minmax(0, 1fr); margin: 0; }
.week-props dt { font-size: .84rem; color: var(--muted); margin: 1px 0; }
.week-props dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.week-prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.week-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; gap: 11px; }
.week-overview > a {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 100px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.week-overview > a:first-child { background: var(--accent); color: white; }
.week-overview > a:hover .week-card-title { text-decoration: underline; }
.week-card-title { display: flex; gap: 6px; align-items: center; justify-content: space-between; font-weight: 700; }
.week-overview > a small { overflow-wrap: anywhere; }
.week-overview > a:not(:first-child) small { color: var(--muted); }
.week-section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.week-stage-view { scroll-margin-top: 112px; }
.week-pill { margin: 0; padding: 2px; display: inline-flex; gap: 2px; flex-wrap: wrap; border: 0; border-radius: 999px; background: var(--surface-2); }
.week-pill > a { text-decoration: none; }
.week-pill > a, .week-pill > button {
  padding: 5px 12px;
  color: var(--secondary);
  font-size: .86rem;
  font-weight: 650;
  border: 0;
  background: transparent;
  border-radius: 999px;
}
.week-pill > [aria-current="page"], .week-pill > [aria-pressed="true"] { color: var(--accent-dark); background: var(--surface); box-shadow: var(--shadow); }
.week-pill > :hover { color: var(--accent-dark); }
.week-link-list { display: flex; flex-wrap: wrap; gap: 4px 9px; align-items: baseline; }
.week-link-list > a { overflow-wrap: anywhere; }
.week-graph { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.week-graph li {
  display: grid;
  align-items: stretch;
  grid-template-columns: minmax(0, .95fr) 25px minmax(0, 1.05fr);
}
.week-graph .week-node {
  display: grid;
  align-content: center;
  gap: 4px;
  min-width: 0;
  padding: 8px 12px;
  background: var(--surface-2);
  border-radius: 8px;
  overflow-wrap: anywhere;
}
.week-graph .week-node-targets { background: var(--blue-bg); }
.week-graph .week-edge { display: grid; place-items: center; color: var(--accent-dark); }
.week-graph .week-edge::before { content: ""; width: 15px; height: 8px; background: currentColor; clip-path: polygon(0 45%, 65% 45%, 65% 0, 100% 50%, 65% 100%, 65% 55%, 0 55%); }
.week-graph .week-edge.is-empty::before { background: var(--line); }
.week-graph a { width: fit-content; font-weight: 650; text-underline-offset: 3px; }
.week-graph .week-node-label { color: var(--muted); font-size: .8rem; }

.week-fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
.week-fieldset legend { margin-bottom: 5px; font-size: .86rem; font-weight: 650; }
.week-options { display: grid; max-height: 235px; overflow: auto; gap: 5px; padding: 2px; margin: -2px; }
.week-option, .week-check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.week-option { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; }
.week-option:has(:checked) { border-color: var(--accent); background: var(--accent-soft); }
.week-option:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.week-option > span { min-width: 0; overflow-wrap: anywhere; }
.week-option small { display: block; color: var(--muted); }
.week-option > input, .week-check > input { flex: 0 0 auto; margin: 3px 0 0; width: 16px; height: 16px; }
.week-choice-search { width: 100%; margin-bottom: 7px; }

.month-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: .86rem; }
.month-notice { display: flex; align-items: flex-start; gap: 7px; padding: 9px 12px; border-radius: 8px; background: var(--surface-2); }
.month-notice svg { flex: 0 0 auto; margin-top: 2px; }
.month-history > summary { cursor: pointer; font-weight: 650; }
.month-history[open] > summary { margin-bottom: 10px; }
.month-priority[hidden] { display: none; }

.scoping-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr));
  gap: 6px;
  padding: 0;
  margin: 0 0 14px;
  list-style: none;
}
.scoping-steps > li {
  min-width: 0;
  padding: 8px 10px;
  display: grid;
  gap: 2px;
  border-radius: 8px;
  background: var(--surface-2);
  overflow-wrap: anywhere;
}
.scoping-steps > li[aria-current="step"] { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.scoping-steps > li > small { color: var(--muted); }
.scoping-history > summary { cursor: pointer; font-weight: 650; }
.scoping-history[open] > summary { margin-bottom: 10px; }

.task-filters { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.task-filter { position: relative; }
.task-filter > summary {
  cursor: pointer;
  padding: 7px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--secondary);
  font-size: .86rem;
  font-weight: 650;
}
.task-filter > summary:hover, .task-filter[open] > summary { background: var(--accent-soft); color: var(--accent-dark); }
.task-filter-options {
  position: absolute;
  z-index: 3;
  top: calc(100% + 5px);
  left: 0;
  width: 240px;
  max-width: calc(100vw - 40px);
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.task-report { padding: 12px 0; border-top: 1px solid var(--line); }
.task-report:first-child { padding-top: 0; border-top: 0; }
.task-report:last-child { padding-bottom: 0; }
.task-history > summary { cursor: pointer; font-weight: 650; }
.task-history[open] > summary { margin-bottom: 10px; }

.register-filters { display: grid; gap: 10px; justify-items: start; }
.register-filter-inputs { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.register-filter-inputs .field { min-width: 130px; }
.register-filter-inputs .field:first-child { flex: 1 1 170px; }
.register-filter-inputs input { width: 100%; min-width: 0; }
.register-selection { display: flex; flex-wrap: wrap; gap: 5px; }
.register-check-card { padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; }
.register-check-card + .register-check-card { margin-top: 8px; }
.register-check-card p { margin: 0; }
.register-timeline { list-style: none; display: grid; margin: 0; padding: 0; }
.register-timeline > li {
  display: grid;
  grid-template-columns: minmax(90px, max-content) minmax(0, 1fr) minmax(0, max-content);
  align-items: start;
  gap: 8px 16px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.register-timeline > li > :first-child { color: var(--muted); font-size: .86rem; }
.register-timeline > li > :last-child { display: grid; justify-items: start; gap: 4px; }
.register-timeline .week-prose { margin: 3px 0 0; }
.register-history > summary, .register-editor > summary { cursor: pointer; font-weight: 650; }
.register-history[open] > summary, .register-editor[open] > summary { margin-bottom: 10px; }
.register-source-text {
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 55vh;
  overflow: auto;
  font-size: .85rem;
}
.register-editor textarea { min-height: 145px; resize: vertical; }
.register-audience { display: grid; gap: 6px; }
.register-conflict { display: grid; gap: 2px; margin-top: 8px; white-space: normal; }
.register-conflict > span { color: var(--muted); font-size: .83rem; }

@container (max-width: 640px) {
  .week-split { grid-template-columns: minmax(0, 1fr); }
  .week-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .week-screen .table-wrap { max-height: none; overflow: visible; }
  .week-screen .week-table, .week-screen .week-table tbody { display: block; }
  .week-screen .week-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .week-screen .week-table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; padding: 11px 0; border-top: 1px solid var(--line); }
  .week-screen .week-table td { display: block; border: 0; padding: 0; }
  .week-screen .week-table td::before { content: attr(data-label); display: block; color: var(--muted); font-size: .74rem; margin-bottom: 2px; }
  .week-screen .week-table td:is(:first-child, [data-label="Действия"], [data-label="Связи"]) { grid-column: 1 / -1; }
  .week-screen .week-table td:is(:first-child, [data-label="Действия"])::before { display: none; }
  .task-filters { position: relative; }
  .task-filter { position: static; }
  .task-filter-options { width: min(280px, 100%); }
  .register-filter-inputs { width: 100%; }
  .register-filter-inputs .field { flex: 1 1 120px; }
  .register-filter-inputs .field:first-child { flex-basis: 100%; }
  .register-timeline > li { grid-template-columns: minmax(0, 1fr) auto; }
  .register-timeline > li > :first-child { grid-column: 1 / -1; }
  .register-timeline > li > :last-child { max-width: 32cqw; }
  .register-timeline > li .week-status { white-space: normal; }
  .week-screen .week-table td[data-label="Аудитория"] { grid-column: 1 / -1; }
}

@container (max-width: 360px) {
  .week-overview { gap: 7px; }
  .week-overview > a { padding: 11px; }
  .week-props { grid-template-columns: minmax(0, 1fr); gap: 3px; }
  .week-props dd { margin-bottom: 7px; }
}
