/* Client checklist page (js/client-view.js). Reuses the variables and the .group/.item/.watch/.note/.tab/.overall
   classes from style.css; everything new is prefixed .cv- */

.cv { padding-bottom: 24px; }
.cv-loading { color: var(--muted); text-align: center; padding: 48px 16px; }

.cv-back { display: inline-block; margin-bottom: 10px; color: var(--accent); text-decoration: none; font-weight: 600; font-size: 14px; border-radius: 6px; }
.cv-back:hover { text-decoration: underline; }
.cv-back:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.cv-head { margin-bottom: 12px; }
.cv-titlerow { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; }
.cv-title { margin: 0; font-size: 24px; line-height: 1.25; overflow-wrap: anywhere; min-width: 0; }
.cv-title:focus { outline: none; }
.cv-sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }

.cv-rename { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px 12px; margin-bottom: 12px; }
.cv-rename .field { margin-bottom: 10px; }
.cv-rename .field input { font: inherit; font-size: 16px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); width: 100%; min-width: 0; }
.cv-rename .field input:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.cv-btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.cv-toolbar { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; margin-bottom: 12px; }
.cv-admin { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

.cv-chip {
  display: inline-flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
  font-size: 13px; padding: 3px 10px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
}
.cv-chip .cv-dot { font-size: 11px; }
.cv-chip[data-state="live"] .cv-dot { color: var(--done); }
.cv-chip[data-state="live"] .cv-chip-state { color: var(--text); font-weight: 600; }
.cv-chip[data-state="offline"] {
  border-color: var(--warn, #b45309); background: var(--warn-soft, var(--note-bg)); color: var(--warn, #b45309);
}
.cv-chip[data-state="offline"] .cv-dot { color: var(--warn, #b45309); }
.cv-chip[data-state="offline"] .cv-chip-state { font-weight: 600; }


/* search box: used by the client page and the master editor */
.cv-search { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cv-search-label { font-size: 14px; font-weight: 600; flex: none; }
.cv-search input[type="search"] {
  flex: 1 1 auto; min-width: 0; font: inherit; font-size: 15px; padding: 9px 12px; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
}
.cv-search input[type="search"]:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.cv-tabhit { display: block; font-size: 12px; color: var(--accent); font-weight: 600; }
.cv-tabs .tab.cv-nohit { opacity: .55; }

.cv-confirm {
  background: var(--card); border: 1px solid var(--accent); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px;
}
.cv-confirm.danger { border-color: var(--danger, #c62828); background: var(--danger-soft, var(--card)); }
.cv-confirm-msg { margin: 0 0 10px; font-size: 14px; overflow-wrap: anywhere; }
.cv-confirm .errbox { margin: 0 0 10px; }

/* tabs stay pinned under the app bar; each one scrolls to its checklist, and scrolling lights up the current one */
.cv-tabs {
  position: sticky; top: var(--cv-top, 0px); z-index: 4; margin: 0 -16px 4px; padding: 8px 16px 8px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.cv-tabs .tab[aria-current="true"] { background: var(--accent-soft); border-color: var(--accent); }
.cv-sop { scroll-margin-top: var(--cv-offset, 120px); margin-bottom: 28px; }
.cv-sop[hidden] { display: none; }
.cv-sop + .cv-sop { padding-top: 8px; border-top: 1px solid var(--line); }
.cv-tabs .tab:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.cv-tabname { display: block; font-weight: 600; }

.cv-panel { margin-top: 12px; }
.cv-panel .sop-head { align-items: flex-end; }
.cv-sopcount { font-size: 14px; }
.cv-empty { text-align: center; color: var(--muted); padding: 24px 12px; margin: 0; background: var(--card); border: 1px dashed var(--line); border-radius: 12px; }

/* "✓ who · when" sits at the right end of the item's own line, so ticking never adds height */
.cv-stamp {
  flex: 0 1 auto; display: flex; margin-left: auto; padding-top: 3px; max-width: 42%; font-size: 12.5px; line-height: 1.4; color: var(--muted);
  white-space: pre; text-decoration: none;
}
.cv-stamp-who { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cv-stamp-when { flex: none; }
.cv-stamp[hidden] { display: none; }
.cv-item.cv-err > label { background: var(--danger-soft, var(--note-bg)); outline: 2px solid var(--danger, #c62828); outline-offset: -2px; }
@media (max-width: 480px) {
  .cv-stamp { max-width: 46%; font-size: 12px; }
  .cv-title { font-size: 21px; }
  .cv-admin { margin-left: 0; }
}

/* toasts, inside the module so it needs nothing from the shell */
.cv-toasts {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 60;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  width: min(480px, calc(100vw - 32px)); display: grid; gap: 8px; pointer-events: none;
}
.cv-toast {
  pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; justify-content: space-between;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text);
  box-shadow: 0 10px 30px rgba(15, 20, 30, .25); font-size: 14px; overflow-wrap: anywhere;
}
.cv-toast.error { border-color: var(--danger, #c62828); background: var(--danger-soft, var(--card)); color: var(--danger, #c62828); }
.cv-toast.ok { border-color: var(--done); }
.cv-toast-x { background: none; border: 0; color: inherit; cursor: pointer; font-size: 20px; line-height: 1; padding: 0 4px; }
.cv-toast-x:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.cv-gone, .cv-loaderr { margin-top: 24px; }

.cv-state-msg { margin: 0 0 12px; }
.cv-gone .btn, .cv-loaderr .btn { display: inline-block; text-decoration: none; margin-top: 0; }
