/* "שינויים" (the change list against last week) and "מטופלים (תצוגה)" (the patient view), with their print rules.
   No inline styles anywhere: swatch colors and the progress bar are set through the CSSOM (--c, --p).
   Classes: dv-* belong to the change list, pv-* to the patient view. */

/* ============================== שינויים ============================== */

.dv-ltr,
.pv-ltr {
  display: inline-block;
  direction: ltr;
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
}

.dv-print {
  display: none;
}

/* ---------- day tabs ---------- */

.dv-toolbar {
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}

.dv-days {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
}

.dv-day {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 22px;
  border: 0;
  border-inline-start: 1px solid var(--line);
  background: #fff;
  color: #3a4651;
  font-size: 15px;
  cursor: pointer;
}

.dv-day:first-child {
  border-inline-start: 0;
}

.dv-day:hover:not(.on) {
  background: var(--accent-soft);
}

.dv-day:focus-visible {
  outline: 3px solid #9db9de;
  outline-offset: -3px;
}

.dv-day.on {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.dv-day-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.dv-day.on .dv-day-count {
  background: rgba(255, 255, 255, 0.9);
}

/* ---------- title and the caveat ---------- */

.dv-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  margin-bottom: 10px;
}

.dv-title h1 {
  margin: 0;
  font-size: 22px;
}

.dv-sub {
  color: var(--muted);
  font-size: 14px;
}

.dv-note {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 1px solid #bcd6f0;
  border-radius: var(--radius);
  background: #eaf3fc;
  color: #1d3f66;
  font-size: 14px;
}

.dv-note-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #3b82c4;
  color: #fff;
  font-size: 13px;
  font-style: italic;
  font-weight: 700;
}

.dv-note-text {
  flex: 1;
}

.dv-note-ok {
  flex: none;
  padding: 2px 6px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.dv-note-ok:focus-visible {
  outline: 3px solid #9db9de;
}

/* ---------- "שונה אחרי הזנה" ---------- */

.dv-changed {
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid var(--warn-line);
  border-radius: var(--radius);
  background: #fffdf0;
  box-shadow: var(--shadow);
}

.dv-changed-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--warn-line);
  background: var(--warn-soft);
  color: var(--warn);
}

.dv-changed-head h2 {
  margin: 0;
  font-size: 1rem;
}

.dv-changed-help {
  flex-basis: 100%;
  margin: 0;
  font-size: 13px;
}

.dv-changed .dv-count {
  background: #fff;
}

/* ---------- layout ---------- */

.dv-layout {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.dv-list {
  flex: 1;
  min-width: 0;
}

.dv-side {
  flex: 0 0 300px;
  width: 300px;
}

.dv-lhead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 12px;
}

.dv-prog {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.dv-bar {
  width: 90px;
  height: 7px;
  overflow: hidden;
  border-radius: 4px;
  background: #cdd9ea;
}

.dv-bar i {
  display: block;
  width: calc(var(--p, 0) * 1%);
  height: 100%;
  border-radius: 4px;
  background: #2e9e5b;
}

.dv-hint {
  margin-inline-start: auto;
  color: var(--muted);
  font-size: 13px;
}

.dv-empty {
  padding: 28px 24px;
  text-align: center;
}

.dv-empty p {
  margin: 0;
}

/* ---------- a staff column and its lines ---------- */

.dv-group {
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.dv-ghead {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line-strong);
  background: #f3f5f8;
}

.dv-swatch {
  flex: 0 0 12px;
  display: inline-block;
}

.dv-gname {
  font-size: 15.5px;
}

.dv-gtype {
  font-size: 13px;
}

.dv-count {
  margin-inline-start: auto;
  padding: 1px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: #52606d;
  font-size: 12.5px;
  white-space: nowrap;
}

.dv-changed-head .dv-count {
  margin-inline-start: 0;
}

.dv-rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dv-row {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 56px;
  padding: 6px 16px;
  border-bottom: 1px solid #edf0f3;
}

.dv-row:last-child {
  border-bottom: 0;
}

.dv-row.is-new {
  background: #f1f7fe;
}

.dv-row.done {
  background: var(--panel-2);
}

.dv-check {
  display: flex;
  flex: 0 0 84px;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: #3a4651;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* the box of the mockup: a rounded square that fills green with a tick */
.dv-box {
  display: inline-grid;
  place-items: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  margin: 0;
  border: 2px solid #98a4b1;
  border-radius: 6px;
  background: #fff;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.dv-box::after {
  content: '✓';
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  opacity: 0;
}

.dv-box:checked {
  border-color: #2e9e5b;
  background: #2e9e5b;
}

.dv-box:checked::after {
  opacity: 1;
}

.dv-box:focus-visible {
  outline: 3px solid #9db9de;
  outline-offset: 1px;
}

.dv-chip {
  flex: 0 0 138px;
  padding: 4px 10px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}

.dv-tone-add {
  border-color: #a9dbb8;
  background: #e3f5e8;
  color: #1b6e36;
}

.dv-tone-rem {
  border-color: #f2b3b8;
  background: #fde8e8;
  color: #b3141f;
}

.dv-tone-mov {
  border-color: #b3cdee;
  background: #e4eefb;
  color: #1f55a8;
}

.dv-tone-dur {
  border-color: #cdbcf2;
  background: #efe8fd;
  color: #5a31b8;
}

.dv-tone-cls {
  border-color: #ccd3da;
  background: #eceff2;
  color: #47525d;
}

.dv-what {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 15.5px;
}

.dv-what-text {
  min-width: 0;
}

.dv-what-text b {
  font-weight: 700;
}

.dv-extra {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
}

.dv-new {
  flex: none;
  padding: 1px 8px;
  border-radius: 4px;
  background: #2f7fc9;
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 18px;
}

.dv-row.done .dv-what {
  color: #9aa5b1;
  text-decoration: line-through;
}

.dv-row.done .dv-swatch,
.dv-row.done .dv-chip {
  opacity: 0.45;
}

.dv-row.done .dv-check {
  color: #7a8591;
}

/* ---------- the summary by kind ---------- */

.dv-sum {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel-2);
  box-shadow: var(--shadow);
}

.dv-sum-head {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line-strong);
  background: #fff;
}

.dv-sum-head h2 {
  margin: 0;
  font-size: 1rem;
}

.dv-sum-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
}

.dv-li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dv-li .dv-chip {
  flex: 0 0 128px;
  padding: 2px 8px;
  font-size: 13px;
}

.dv-n {
  margin-inline-start: auto;
  font-size: 15px;
  font-weight: 700;
}

.dv-sum-body hr {
  margin: 2px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.dv-none {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 20px;
}

.dv-none b {
  color: #3a4651;
  font-weight: 600;
}

/* The alerts drawer leaves about 870px at the 1280px minimum: the summary goes under the list, laid out in a row. */
.week-body.drawer-open .dv-layout {
  flex-direction: column;
  align-items: stretch;
}

.week-body.drawer-open .dv-side {
  flex: none;
  width: auto;
}

.week-body.drawer-open .dv-sum-body {
  flex-flow: row wrap;
  align-items: center;
  gap: 8px 18px;
}

.week-body.drawer-open .dv-sum-body hr {
  display: none;
}

.week-body.drawer-open .dv-li .dv-chip {
  flex-basis: auto;
}

.week-body.drawer-open .dv-n {
  margin-inline-start: 0;
}

/* ============================== מטופלים (תצוגה) ============================== */

.pv-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.pv-head h1 {
  margin-bottom: 2px;
}

.pv-help {
  max-width: 62ch;
  margin: 0;
  font-size: 0.92rem;
}

.pv-search {
  width: 240px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
}

.pv-card {
  padding: 0;
  /* clip, not hidden: a scroll container would make the sticky header stick to the card instead of the page */
  overflow: clip;
}

.pv-empty {
  margin: 0;
  padding: 28px 24px;
  text-align: center;
}

.pv-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.pv-table th,
.pv-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: start;
}

.pv-table thead th {
  position: sticky;
  top: calc(var(--header-h) + var(--stepper-h));
  z-index: 2;
  border-bottom: 1px solid var(--line-strong);
  background: var(--panel-2);
  font-size: 0.93rem;
  white-space: nowrap;
}

.pv-table th.pv-who {
  width: 138px;
}

.pv-table th.pv-summary {
  width: 214px;
}

.pv-day .day-badge {
  margin-inline-start: 6px;
}

.pv-date {
  font-size: 0.85rem;
}

.pv-row:last-child th,
.pv-row:last-child td {
  border-bottom: 0;
}

.pv-who {
  background: #fff;
}

.pv-name-btn {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 700;
  text-align: start;
  cursor: pointer;
}

.pv-name-btn:hover {
  color: var(--accent);
  text-decoration: underline;
}

.pv-name-btn:focus-visible {
  outline: 3px solid #9db9de;
  outline-offset: 1px;
}

.pv-absent-tag,
.pv-absent {
  display: inline-block;
  margin-top: 4px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e6e6e6;
  color: #3a4651;
  font-size: 11.5px;
  font-weight: 700;
}

.pv-row.absent .pv-name-btn {
  color: var(--muted);
}

.pv-cell {
  border-inline-start: 1px solid var(--line);
  background: #fff;
}

.pv-cell.off {
  background: #f1f2f4;
}

.pv-item {
  position: relative;
  display: block;
  width: 100%;
  margin: 0 0 4px;
  padding: 3px 6px 3px 6px;
  border: 1px solid rgba(16, 24, 40, 0.16);
  border-inline-start: 5px solid var(--c, #d9d9d9);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.3;
  text-align: start;
  cursor: pointer;
}

/* the type's color as a tint behind the text */
.pv-item::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 3px;
  background: var(--c, #d9d9d9);
  opacity: 0.26;
  pointer-events: none;
}

.pv-item > * {
  position: relative;
}

.pv-item:last-child {
  margin-bottom: 0;
}

.pv-item:hover {
  border-color: var(--accent);
}

.pv-item:focus-visible {
  outline: 3px solid #9db9de;
  outline-offset: 1px;
}

.pv-item.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px var(--danger);
}

.pv-item-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 4px;
}

.pv-name {
  font-weight: 700;
}

.pv-staff {
  display: block;
  color: #52606d;
  font-size: 11.5px;
}

.pv-tag {
  padding: 0 4px;
  border-radius: 3px;
  background: #fff;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 15px;
}

.pv-tag.short {
  border: 1px solid #d9bd36;
  color: var(--warn);
}

.pv-tag.entered {
  color: var(--ok);
}

.pv-tag.flagged {
  background: var(--warn-soft);
  color: var(--warn);
}

.pv-summary {
  border-inline-start: 1px solid var(--line);
  background: var(--panel-2);
}

.pv-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.pv-total {
  padding: 0 8px;
  border: 1px solid var(--ok-line);
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  white-space: nowrap;
}

.pv-total.state-short {
  border-color: var(--danger-line);
  background: var(--danger-soft);
  color: var(--danger);
}

.pv-total.state-over {
  border-color: #f2c48a;
  background: #fff1e0;
  color: #a45a00;
}

.pv-total.group {
  border-color: var(--line-strong);
  background: #fff;
  color: #52606d;
}

.pv-four {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.pv-four.some {
  color: #a45a00;
  font-weight: 700;
}

.pv-checks {
  margin: 6px 0 0;
  padding: 0;
  color: var(--warn);
  font-size: 12px;
  line-height: 1.35;
  list-style: none;
}

.pv-checks li + li {
  margin-top: 3px;
}

/* the alerts drawer leaves about 870px: the columns get narrower */
.week-body.drawer-open .pv-table th.pv-who {
  width: 110px;
}

.week-body.drawer-open .pv-table th.pv-summary {
  width: 176px;
}

.week-body.drawer-open .pv-table th,
.week-body.drawer-open .pv-table td {
  padding: 6px;
}

/* ============================== print ============================== */

@media print {
  /* the app around these two views is not printed */
  body:has(.dv-root) .app-header,
  body:has(.dv-root) .notice,
  body:has(.dv-root) .drawer-host,
  body:has(.dv-root) #modal-root,
  body:has(.dv-root) #warn-root,
  body:has(.pv-root) .app-header,
  body:has(.pv-root) .notice,
  body:has(.pv-root) .drawer-host,
  body:has(.pv-root) #modal-root,
  body:has(.pv-root) #warn-root {
    display: none !important;
  }

  body:has(.dv-root) .week-body.drawer-open,
  body:has(.pv-root) .week-body.drawer-open {
    padding: 0 !important;
  }

  body:has(.dv-root),
  body:has(.pv-root) {
    min-width: 0;
  }

  .dv-root,
  .pv-root {
    max-width: none;
    padding: 0;
  }

  /* change list: the interactive screen gives way to the checklist */
  .dv-screen {
    display: none !important;
  }

  .dv-print {
    display: block;
    color: #000;
    font-size: 11pt;
  }

  .dv-print h1 {
    margin: 0 0 10pt;
    font-size: 16pt;
  }

  .dv-print h2 {
    margin: 0 0 8pt;
    padding-bottom: 3pt;
    border-bottom: 1.5pt solid #000;
    font-size: 14pt;
  }

  .dv-print h3 {
    margin: 0 0 3pt;
    font-size: 11.5pt;
  }

  .dv-print-day {
    margin: 0 0 14pt;
    break-after: page;
    page-break-after: always;
  }

  .dv-print-day:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  .dv-print-group {
    margin: 0 0 9pt;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .dv-print-list {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .dv-print-list li {
    display: flex;
    align-items: center;
    gap: 8pt;
    padding: 3pt 0;
    border-bottom: 0.5pt solid #999;
    font-size: 11pt;
    break-inside: avoid;
  }

  .dv-print-box {
    flex: 0 0 11pt;
    width: 11pt;
    height: 11pt;
    border: 1.2pt solid #000;
  }

  /* patient view: a compact table, no search box */
  .pv-search {
    display: none;
  }

  .pv-card {
    border: 0;
    box-shadow: none;
  }

  .pv-table {
    font-size: 8.5pt;
  }

  .pv-table thead th {
    position: static;
    background: #fff;
  }

  .pv-row {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .pv-item {
    font-size: 8pt;
  }

  .pv-item::before {
    opacity: 0.4;
  }
}
