/* Chore chart maker (/tools/chore-chart-maker): people list, chore cards with day chips, quick-add
   presets, the load bars and the chart table, plus a print layout that prints only the chart.
   Builds on the .nk-* tools block in site.css. */

/* People: two columns of name fields on wide cards, one column on phones. */
.nk-cc-people {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr));
  gap: 10px;
}
.nk-cc-person {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) 36px;
  gap: 8px;
  align-items: center;
}

/* One chore = a small parchment card. */
.nk-cc-tasks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.nk-cc-task {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  background: #f7f1e8;
}
.nk-cc-task__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 8px;
  align-items: center;
}
.nk-cc-task__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  padding-right: 44px;
}
.nk-cc-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.nk-cc-field > span {
  font-size: 13px;
  font-weight: 600;
  color: #7a6a5c;
}
.nk-cc-task .nk-input {
  height: 46px;
}
.nk-cc-select {
  height: 46px;
  padding-right: 36px;
  font-size: 16px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238b5e3c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

/* Day chips (Mon … Sun). */
.nk-cc-days {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.nk-cc-days[hidden] {
  display: none;
}
.nk-cc-days legend {
  padding: 0;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: #7a6a5c;
}
.nk-cc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.nk-cc-chip {
  position: relative;
  cursor: pointer;
}
.nk-cc-chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.nk-cc-chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 36px;
  box-sizing: border-box;
  padding: 0 10px;
  border-radius: 999px;
  border: 1.5px solid #ddd5c8;
  font-size: 14px;
  font-weight: 500;
  color: #9a8570;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}
.nk-cc-chip input:checked + span {
  background: #fffdf9;
  border-color: #7a9970;
  color: #2e2018;
}
.nk-cc-chip input:focus-visible + span {
  outline: 2px solid #8b5e3c;
  outline-offset: 2px;
}
.nk-cc-chip:hover span {
  border-color: #c8bbae;
}

/* Quick-add presets. */
.nk-cc-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.nk-cc-preset {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px dashed #c8bbae;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #7a6a5c;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}
.nk-cc-preset:hover {
  background: #f7f1e8;
  color: #2e2018;
}
.nk-cc-preset:focus-visible {
  outline: 2px solid #8b5e3c;
  outline-offset: 2px;
}

/* Load per person: name, points and a bar. */
.nk-cc-load {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.nk-cc-load li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: center;
}
.nk-cc-load .nk-split-bar {
  grid-column: 1 / -1;
  height: 10px;
}
.nk-cc-load__who {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 600;
  color: #2e2018;
  overflow-wrap: anywhere;
}
.nk-cc-load__pts {
  font-size: 15px;
  color: #7a6a5c;
  font-variant-numeric: tabular-nums;
}

/* Chart table: week rows, chore columns. */
.nk-cc-table th,
.nk-cc-table td {
  text-align: left;
  vertical-align: top;
  padding: 10px 12px;
}
.nk-cc-table thead th {
  min-width: 96px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
  color: #2e2018;
}
.nk-cc-table small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 400;
  color: #9a8570;
}
.nk-cc-table tbody th {
  font-weight: 600;
  color: #2e2018;
  white-space: nowrap;
}
.nk-cc-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: #2e2018;
}
/* Tick boxes (one per time, labelled with the day), shown only on paper. */
.nk-cc-ticks {
  display: none;
}
.nk-cc-off {
  color: #c8bbae;
}
.nk-cc-table td {
  transition: opacity 0.15s ease;
}
.nk-cc-table td.nk-cc-dim {
  opacity: 0.25;
}
.nk-cc-chart .nk-chip {
  min-height: 36px;
  padding: 0 14px;
  gap: 6px;
  font-size: 14px;
}
.nk-cc-chart .nk-chip[aria-pressed='true'] {
  background: #f2ebe0;
  border-color: rgba(59, 48, 43, 0.4);
  color: #2e2018;
  font-weight: 600;
}

/* Calendar view: one month grid per month, entries tinted with the person's colour. */
.nk-cc-chart [hidden] {
  display: none !important;
}
.nk-cc-months {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.nk-cc-month h3 {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 700;
  color: #2e2018;
}
.nk-cc-cal {
  width: 100%;
  min-width: 720px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e5ddd2;
  border-radius: 14px;
  overflow: hidden;
}
.nk-cc-cal th {
  padding: 8px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8b5e3c;
  background: #f7f1e8;
  border-bottom: 1px solid #e5ddd2;
}
.nk-cc-cal td {
  height: 110px;
  padding: 6px;
  vertical-align: top;
  border-right: 1px solid #efe8de;
  border-bottom: 1px solid #efe8de;
}
.nk-cc-cal td:last-child {
  border-right: 0;
}
.nk-cc-cal tr:last-child td {
  border-bottom: 0;
}
.nk-cc-cal__dim {
  background: #faf7f2;
}
.nk-cc-cal__date {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 600;
  color: #7a6a5c;
}
.nk-cc-cal__dim .nk-cc-cal__date {
  color: #c8bbae;
}
.nk-cc-cal ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.nk-cc-cal li {
  padding: 3px 6px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.3;
  color: #2e2018;
  background: color-mix(in srgb, var(--c) 30%, #fff);
  overflow-wrap: anywhere;
  transition: opacity 0.15s ease;
}
.nk-cc-cal li b {
  font-weight: 600;
}
.nk-cc-cal li small {
  color: #7a6a5c;
}
.nk-cc-cal li.nk-cc-dim {
  opacity: 0.25;
}
.nk-cc-printonly {
  display: none !important;
}
/* "×2" only means something in the table. */
.nk-cc-months:not([hidden]) ~ .nk-cc-foot .nk-cc-noprint {
  display: none;
}

/* Reference and comparison tables: left-aligned text. */
.nk-cc-ref th,
.nk-cc-ref td {
  text-align: left;
}
.nk-cc-ref tbody th {
  font-weight: 600;
  color: #2e2018;
}

/* Disabled add/remove buttons (limits, last person). */
[data-chore-chart] .nk-icon-btn:disabled,
[data-chore-chart] .nk-text-btn:disabled,
[data-chore-chart] .nk-cc-preset:disabled {
  opacity: 0.35;
  cursor: default;
  text-decoration: none;
  background: transparent;
}

@media (max-width: 480px) {
  .nk-cc-task {
    padding: 12px;
  }
  .nk-cc-task .nk-input {
    padding: 0 10px;
  }
  .nk-cc-select {
    padding-right: 32px !important;
    background-position: right 10px center;
  }
  .nk-cc-task__row {
    padding-right: 0;
  }
  .nk-cc-chip span {
    min-width: 42px;
    padding: 0 6px;
  }
  .nk-cc-table {
    font-size: 14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .nk-cc-chip span,
  .nk-cc-preset,
  .nk-cc-table td,
  .nk-cc-cal li {
    transition: none;
  }
}

/* Print: only the shown view (table or calendar), landscape, filling the page, with a legend,
   tick boxes and a small Klusek footer. */
@page {
  size: A4 landscape;
  margin: 12mm;
}
@media print {
  body > div > :not(main),
  main > section:not(#calculator),
  #calculator > [aria-hidden],
  [data-chore-chart],
  noscript,
  .nk-cc-noprint,
  #cookie-banner {
    display: none !important;
  }
  body,
  body > div,
  #calculator {
    background: #fff !important;
  }
  #calculator {
    padding: 0 !important;
  }
  .nk-cc-chart {
    background: #fff !important;
    box-shadow: none !important;
    padding: 0 !important;
    gap: 5mm !important;
  }
  .nk-cc-chart * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .nk-cc-chart h2 {
    font-size: 26pt !important;
  }
  .nk-cc-printonly {
    display: revert !important;
  }
  .nk-table-wrap {
    overflow: visible;
  }

  /* Legend: who is who, with points. */
  .nk-cc-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex !important;
    flex-wrap: wrap;
    gap: 2mm 5mm;
    font-size: 10.5pt;
    font-weight: 600;
    color: #2e2018;
  }
  .nk-cc-legend li {
    display: flex;
    align-items: center;
    gap: 2mm;
  }
  .nk-cc-legend .nk-swatch {
    width: 3.5mm;
    height: 3.5mm;
  }
  .nk-cc-legend small {
    font-weight: 400;
    color: #9a8570;
  }

  /* Table: rounded frame, tinted header and week column, a name pill and tick boxes per cell. */
  .nk-cc-table {
    font-size: 10.5pt;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid #d8cfc3;
    border-radius: 4mm;
    overflow: hidden;
  }
  .nk-cc-table th,
  .nk-cc-table td {
    padding: 2.5mm 3mm;
    border: 0;
    border-right: 1px solid #e5ddd2;
    border-bottom: 1px solid #e5ddd2;
    vertical-align: middle;
  }
  .nk-cc-table tr > :last-child {
    border-right: 0;
  }
  .nk-cc-table tbody tr:last-child > * {
    border-bottom: 0;
  }
  .nk-cc-table thead th {
    background: #f2ebe0;
    font-size: 10.5pt;
    vertical-align: bottom;
  }
  .nk-cc-table tbody th {
    background: #faf6f0;
    font-size: 11pt;
  }
  .nk-cc-table tbody tr {
    height: var(--cc-row, 20mm);
    break-inside: avoid;
  }
  .nk-cc-table td > small {
    display: none;
  }
  .nk-cc-cell {
    padding: 1mm 3mm 1mm 2mm;
    border-radius: 999px;
    background: color-mix(in srgb, var(--c) 32%, #fff);
    font-weight: 600;
  }
  .nk-cc-ticks {
    display: flex;
    flex-wrap: wrap;
    gap: 1mm;
    margin-top: 2mm;
  }
  .nk-cc-ticks i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 4.6mm;
    height: 4.6mm;
    border: 1px solid #b9a998;
    border-radius: 1mm;
    font-style: normal;
    font-size: 5.5pt;
    color: #b9a998;
  }
  .nk-cc-off {
    text-align: center !important;
  }
  .nk-cc-table td.nk-cc-dim,
  .nk-cc-cal li.nk-cc-dim {
    opacity: 0.3;
  }

  /* Calendar: one month per block, a tick box after every entry. */
  .nk-cc-months {
    gap: 6mm;
  }
  .nk-cc-month {
    break-inside: avoid;
  }
  .nk-cc-month h3 {
    margin-bottom: 2mm;
    font-size: 14pt;
  }
  .nk-cc-cal {
    min-width: 0;
    border-color: #d8cfc3;
    border-radius: 4mm;
  }
  .nk-cc-cal th {
    padding: 1.5mm 2mm;
    font-size: 8pt;
    background: #f2ebe0;
  }
  .nk-cc-cal td {
    height: 24mm;
    padding: 1.5mm;
    border-color: #e5ddd2;
  }
  .nk-cc-cal__date {
    margin-bottom: 1mm;
    font-size: 9pt;
  }
  .nk-cc-cal ul {
    gap: 0.8mm;
  }
  .nk-cc-cal li {
    display: flex;
    align-items: baseline;
    gap: 1mm;
    padding: 0.6mm 1.5mm;
    border-radius: 1.2mm;
    font-size: 7.5pt;
  }
  .nk-cc-cal li::after {
    content: '';
    flex: none;
    width: 2.6mm;
    height: 2.6mm;
    margin-left: auto;
    align-self: center;
    border: 1px solid rgba(46, 32, 24, 0.45);
    border-radius: 0.6mm;
    background: #fff;
  }

  /* Footer: Klusek's head and the site. */
  .nk-cc-foot {
    display: flex;
    align-items: center;
    gap: 2mm;
    font-size: 9pt !important;
  }
  .nk-cc-foot img {
    width: 8mm;
    height: auto;
  }
}
