.pw {
  --pw-line: #dce5df;
  --pw-muted: #64736c;
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  min-width: 0;
  color: #253b31;
  font-size: var(--ui-body, 18px);
}
.pw *,
.pw-reasons-dialog * {
  box-sizing: border-box;
}
.pw h1 {
  margin: 0;
  font-size: 32px;
}
.pw h2 {
  font-size: var(--ui-section, 26px);
  margin: 0 0 16px;
}
.pw h3 {
  font-size: var(--ui-card, 20px);
  margin: 0 0 10px;
}
.pw p {
  margin: 4px 0;
}
.pw .pw-heading,
.pw-reasons-dialog .pw-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.pw .pw-pagehead {
  margin-bottom: 24px;
}
.pw-hint,
.pw .pw-hint {
  font-size: var(--ui-caption, 16px);
  color: #64736c;
  line-height: 1.5;
}
.pw .pw-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.pw .pw-tabs button {
  border: 0;
  background: #f2f6f2;
  padding: 10px 15px;
}
.pw .pw-tabs button.selected {
  background: #e3eee6;
  color: #28523d;
  font-weight: 600;
}
.pw .pw-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.8fr);
  gap: 26px;
}
.pw .pw-workspace > section {
  min-width: 0;
}
.pw .pw-cards {
  display: grid;
  gap: 14px;
}
.pw .pw-card {
  background: #fff;
  border: 1px solid var(--pw-line);
  border-radius: 12px;
  padding: 18px;
}
.pw .pw-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}
.pw .pw-card-top h3 {
  min-width: 0;
  overflow-wrap: anywhere;
  padding-top: 7px;
}
.pw .pw-title {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  font-size: inherit;
  font-weight: 600;
  min-height: 30px;
}
.pw .pw-marks {
  display: flex;
  gap: 8px;
  flex: none;
}
.pw .pw-marks button {
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  opacity: 1;
}
.pw .pw-marks svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pw .pw-done {
  color: #7ba98b;
  background: #edf6ef;
}
.pw .pw-missed {
  color: #d59c97;
  background: #fbeeed;
}
.pw .pw-marks[data-result='done'] .pw-done {
  background: #23b14d;
  color: white;
}
.pw .pw-marks[data-result='missed'] .pw-missed {
  background: #d94444;
  color: white;
}
.pw .pw-marks button:disabled {
  cursor: default;
}
.pw .pw-meta,
.pw .pw-responsible,
.pw .pw-change,
.pw .pw-result,
.pw .pw-note {
  font-size: var(--ui-caption, 16px);
  line-height: 1.5;
}
.pw .pw-meta,
.pw .pw-change {
  color: var(--pw-muted);
}
.pw .pw-responsible label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-direction: row;
  flex-wrap: wrap;
  color: var(--pw-muted);
}
.pw .pw-responsible select {
  width: auto;
  max-width: 100%;
  min-height: 38px;
  font-size: var(--ui-caption, 16px);
  padding: 5px 8px;
  background: #fff;
}
.pw .pw-change {
  margin-top: 8px;
  overflow-wrap: anywhere;
}
.pw .pw-change li {
  margin-top: 7px;
}
.pw .pw-change li span {
  display: block;
}
.pw .pw-result {
  border-top: 1px solid var(--pw-line);
  margin-top: 10px;
  padding-top: 9px;
  color: #a43b35;
}
.pw .pw-time {
  font-weight: 500;
}
.pw .pw-table-wrap {
  border: 1px solid var(--pw-line);
  border-radius: 9px;
  overflow: auto;
  background: #fff;
}
.pw table {
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
  font-size: var(--ui-caption, 16px);
  margin: 0;
}
.pw th,
.pw td {
  padding: 12px 9px;
  border-bottom: 1px solid var(--pw-line);
  text-align: left;
  vertical-align: middle;
}
.pw thead {
  background: #f2f6f1;
  color: var(--pw-muted);
}
.pw .pw-dates th:first-child {
  width: 42px;
}
.pw .pw-dates th:nth-child(2) {
  width: 116px;
}
.pw .pw-dates td:first-child {
  color: var(--pw-muted);
}
.pw .pw-names {
  white-space: nowrap;
  overflow-x: auto;
  max-width: 100%;
  padding: 2px 0 4px;
  scrollbar-width: thin;
}
.pw .pw-date,
.pw .pw-course-name {
  padding: 0;
  min-height: 34px;
  white-space: nowrap;
  border: 0;
  background: transparent;
  font-size: var(--ui-caption, 16px);
}
.pw .pw-date:hover,
.pw .pw-course-name:hover {
  text-decoration: underline;
}
.pw .pw-skipped {
  text-decoration: line-through;
  color: #a33b33;
}
.pw .pw-date-controls {
  display: flex;
  gap: 5px;
  align-items: center;
}
.pw .pw-date-controls input {
  max-width: 160px;
  min-width: 0;
}
.pw .pw-stats {
  min-width: 430px;
}
.pw .pw-stats th:first-child {
  width: 40%;
}
.pw .pw-stats td {
  text-align: center;
}
.pw .pw-stats tfoot {
  background: #f2f6f1;
  font-weight: 600;
}
.pw .pw-range {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: 20px;
}
.pw .pw-range input {
  width: 170px;
}
.pw .pw-editor {
  border: 1px solid #d5dfd5;
  background: #f7faf5;
  padding: 18px;
  border-radius: 10px;
  margin: 15px 0;
}
.pw .pw-editor label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 9px 0;
}
.pw .pw-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px;
}
.pw .pw-full {
  grid-column: 1 / -1;
}
.pw .pw-editor input,
.pw .pw-editor select,
.pw .pw-editor textarea {
  width: 100%;
  min-width: 0;
  font-size: var(--ui-control, 17px);
}
.pw .pw-editor textarea {
  min-height: 90px;
}
.pw-actions,
.pw .pw-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.pw-error,
.pw .pw-error {
  color: #a33b33;
}
.pw-link,
.pw .pw-link {
  border: 0;
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 4px;
  color: #365b45;
  padding: 4px 0;
}
.pw .pw-skip {
  background: #fcfaf8;
  border-color: #dfd2c9;
}
.pw .pw-reasons {
  border: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}
.pw .pw-reasons label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  border: 1px solid #d8dcd5;
  background: #fff;
  border-radius: 7px;
  padding: 9px 11px;
  min-height: 44px;
  margin: 0;
}
.pw .pw-reasons label:has(input:checked) {
  background: #fff1ec;
  border-color: #ba6b5b;
  color: #8c3d31;
}
.pw .pw-reasons input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  accent-color: #a44738;
  flex: none;
}
.pw .pw-skip .primary {
  background: #a44738;
}
.pw .pw-history-day {
  margin: 20px 0;
}
.pw-selector {
  display: flex;
  gap: 15px;
  justify-content: space-between;
  align-items: end;
  flex-wrap: wrap;
  margin: 0 0 16px;
}
.pw-selector label {
  flex: 1;
  max-width: 450px;
}
.pw-selector select {
  width: 100%;
}
.pw-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.pw-reasons-dialog {
  width: min(720px, calc(100% - 28px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 26px;
  border: 1px solid #dce5df;
  border-radius: 14px;
  background: #fff;
  color: #253b31;
  overflow: auto;
  box-shadow: 0 18px 70px #1f392a30;
}
.pw-reasons-dialog::backdrop {
  background: #22382b55;
}
body:has(.pw-reasons-dialog[open]) {
  overflow: hidden;
}
.pw-reasons-dialog h2 {
  font-size: var(--ui-section, 26px);
  margin: 0;
}
.pw-reasons-dialog .pw-hint {
  margin: 16px 0;
}
.pw-reason-list {
  display: grid;
  gap: 10px;
}
.pw-reason-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 8px;
  position: relative;
  align-items: center;
}
.pw-reason-row input {
  width: 100%;
  min-width: 0;
  font-size: var(--ui-control, 17px);
}
.pw-reason-actions {
  display: flex;
  gap: 5px;
}
.pw-reason-actions button {
  min-width: 38px;
  min-height: 44px;
  padding: 5px;
}
.pw-grip {
  width: 36px;
  padding: 4px;
  min-height: 44px;
  background: transparent;
  border: 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
  color: #64736c;
  font-size: 24px;
}
.pw-reason-row.dragging {
  opacity: 0.45;
}
.pw-reason-row.drop-before::before,
.pw-reason-row.drop-after::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: #347853;
  pointer-events: none;
}
.pw-reason-row.drop-before::before {
  top: -6px;
}
.pw-reason-row.drop-after::after {
  bottom: -6px;
}
@media (max-width: 1100px) {
  .pw .pw-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 600px) {
  .pw {
    padding: 15px 12px;
  }
  .pw .pw-pagehead,
  .pw .pw-heading {
    flex-wrap: wrap;
  }
  .pw .pw-pagehead h1 {
    font-size: 28px;
  }
  .pw .pw-card {
    padding: 14px;
  }
  .pw .pw-fields {
    grid-template-columns: 1fr;
  }
  .pw .pw-workspace {
    gap: 24px;
  }
  .pw .pw-dates th:first-child {
    width: 35px;
  }
  .pw .pw-dates th:nth-child(2) {
    width: 105px;
  }
  .pw th,
  .pw td {
    padding: 10px 6px;
  }
  .pw .pw-date {
    min-height: 44px;
  }
  .pw .pw-editor {
    padding: 13px;
  }
  .pw .pw-reasons {
    display: grid;
    grid-template-columns: 1fr;
  }
  .pw-reasons-dialog {
    padding: 18px 14px;
  }
  .pw-reason-row {
    grid-template-columns: 36px minmax(0, 1fr);
  }
  .pw-reason-actions {
    grid-column: 2;
    justify-content: end;
  }
  .pw-reason-actions button {
    min-width: 44px;
  }
  .pw-grip {
    grid-row: 1 / 3;
    align-self: start;
  }
}

.pw .pw-delete-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
.pw .pw-delete {
  color: #a33b33;
  font-size: var(--ui-caption, 16px);
  min-height: 40px;
}
.pw-delete-dialog fieldset {
  border: 0;
  padding: 0;
  margin: 18px 0;
  display: grid;
  gap: 12px;
}
.pw-delete-dialog .pw-delete-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid #dce5df;
  border-radius: 8px;
  padding: 12px;
}
.pw-delete-dialog input[type='radio'] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin-top: 3px;
  flex: none;
}
.pw-delete-option span {
  display: block;
}
.pw-delete-option small {
  display: block;
  margin-top: 4px;
  font-size: var(--ui-caption, 16px);
  color: #64736c;
}
.pw-delete-dialog .danger {
  background: #a33b33;
  color: white;
}
.pw-delete-dialog .pw-error {
  color: #a33b33;
}

.pw .pw-assignment-filter label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  margin: 0;
}
.pw .pw-assignment-filter select {
  max-width: 100%;
  font-size: var(--ui-control);
}
.pw .pw-assignment-filter .pw-error:empty {
  display: none;
}
@media (max-width: 760px) {
  .pw .pw-assignment-filter {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pw .pw-assignment-filter label:first-child,
  .pw .pw-assignment-filter label:has([data-p-order]),
  .pw .pw-assignment-filter .pw-error {
    grid-column: 1/-1;
  }
  .pw .pw-assignment-filter input {
    width: 100%;
    min-width: 0;
  }
}
