/* ============================================================================
   Barmaso — Shop Check (Shop Check · Staff Analysis · Shop Visit) and
   Setup › Set Up For Saleman › Retail
   ----------------------------------------------------------------------------
   Done standing in a shop on a phone: big targets, the result always in
   sight, a tick that reads as a tick. The score card, categories and grade
   colours are Shop Check's own (portal.css); what is here is the page head
   with its tools, the people's ticks, the visit's points, History, and the
   staff list in Setup.
   ============================================================================ */

.sc-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; }
.sc-page > .panel { padding: 0; border: 0; background: none; box-shadow: none; }
.sc-body { display: grid; gap: 14px; min-width: 0; }

/* --- the head and its tools ------------------------------------------------- */

.sc-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 20px; }
.sc-head-text { flex: 1 1 320px; min-width: 0; }
.sc-title { margin: 0; font-family: var(--font-display); font-size: 21px; font-weight: 600; color: var(--pt-ink); }
.sc-sub { margin: 4px 0 0; font-size: 13px; line-height: 1.55; color: var(--pt-slate); }
.sc-tools { display: inline-flex; gap: 8px; }
.sc-tool {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--pt-line); border-radius: 10px; background: #fff;
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--pt-ink); cursor: pointer;
}
.sc-tool:hover { border-color: var(--pt-green-600); color: var(--pt-green-700); }
.sc-tool:focus-visible { outline: 2px solid var(--pt-ink); outline-offset: 2px; }

/* --- Staff Analysis ------------------------------------------------------------ */

.sc-staff-wrap { overflow-x: auto; border: 1px solid var(--pt-line); border-radius: 14px; background: #fff; }
.sc-staff { width: 100%; border-collapse: collapse; font-size: 13px; }
.sc-staff th {
  position: sticky; top: 0; z-index: 1; padding: 10px 8px; border-bottom: 1px solid var(--pt-line); background: #f8fafc;
  font-size: 12px; font-weight: 700; line-height: 1.25; color: var(--pt-slate); text-align: center; vertical-align: bottom;
}
.sc-staff th.sc-c-person, .sc-staff th.sc-c-remark { text-align: left; }
.sc-staff td { padding: 10px 8px; border-bottom: 1px solid var(--pt-line-soft); vertical-align: middle; }
.sc-staff tbody tr:last-child td { border-bottom: 0; }
.sc-c-person { min-width: 190px; }
.sc-c-person { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 2px 8px; align-items: start; }
.sc-staff th.sc-c-person { display: table-cell; }
.sc-person-no { grid-row: span 2; padding-top: 2px; font-size: 12px; font-weight: 700; color: var(--pt-muted); }
.sc-person-text { display: grid; gap: 1px; min-width: 0; }
.sc-person-text b { font-size: 13.5px; font-weight: 600; color: var(--pt-ink); overflow-wrap: anywhere; }
.sc-person-text small { font-size: 12px; color: var(--pt-muted); }
.sc-skip-toggle { grid-column: 2; display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; color: var(--pt-slate); cursor: pointer; }
.sc-skip-toggle input { width: 15px; height: 15px; accent-color: var(--pt-slate); }
.sc-c-mark { width: 64px; text-align: center; }
.sc-mark { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; cursor: pointer; }
.sc-mark:hover { background: var(--pt-green-50); }
.sc-mark input { width: 20px; height: 20px; margin: 0; accent-color: var(--pt-green-700); cursor: pointer; }
.sc-mark-text { display: none; }
.sc-c-result { width: 120px; white-space: nowrap; }
.sc-c-remark { min-width: 160px; }
.sc-remark { min-height: 36px; padding: 4px 8px; font-size: 13px; }
.sc-person.is-skipped td { background: #fafafa; }
.sc-person.is-skipped .sc-person-text b { color: var(--pt-muted); text-decoration: line-through; }
.check-badge.sc-skip { background: var(--pt-line-soft); color: var(--pt-slate); }
.sc-add { display: flex; flex-wrap: wrap; gap: 8px; }
.sc-add .field-input { flex: 1 1 200px; }
.sc-add .btn { display: inline-flex; align-items: center; gap: 6px; }

/* --- Shop Visit ---------------------------------------------------------------- */

.sc-visit-fields { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 0.8fr); }
.sc-staff-fields { grid-template-columns: minmax(0, 1.4fr) minmax(170px, 1fr); }
.sc-items { display: grid; gap: 6px; }
.sc-item {
  position: relative; display: grid; grid-template-columns: 28px 22px minmax(0, 1fr); align-items: center; gap: 10px;
  min-height: 46px; padding: 8px 12px; border: 1px solid var(--pt-line); border-radius: 10px; background: #fff; cursor: pointer;
}
.sc-item input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sc-item-box { display: grid; place-items: center; width: 26px; height: 26px; border: 1.5px solid #cbd5e1; border-radius: 7px; color: transparent; background: #fff; }
.sc-item-no { font-size: 12px; font-weight: 700; color: var(--pt-muted); }
.sc-item-text { font-size: 13.5px; line-height: 1.5; color: var(--pt-ink); }
.sc-item:hover { border-color: #a7f3d0; }
.sc-item:has(input:checked) { border-color: #86efac; background: #f0fdf4; }
.sc-item:has(input:checked) .sc-item-box { border-color: var(--pt-green-600); background: var(--pt-green-600); color: #fff; }
.sc-item:has(input:focus-visible) { outline: 2px solid var(--pt-ink); outline-offset: 2px; }
.sc-cat-actions { display: flex; justify-content: flex-end; margin-top: 8px; }

/* --- History ------------------------------------------------------------------- */

.sc-history { display: grid; gap: 12px; min-width: 0; }
.sc-history-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.sc-month { display: inline-flex; align-items: center; gap: 4px; }
.sc-month-label { min-width: 104px; text-align: center; font-weight: 700; color: var(--pt-ink); font-variant-numeric: tabular-nums; }
.sc-month .ucx-icon-btn:disabled { opacity: 0.35; }
.sc-history-shop { flex: 0 1 280px; min-height: 40px; }
.sc-history-list { display: grid; gap: 10px; }
.sc-history-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.sc-history-actions .btn { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.sc-history-avg { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--pt-slate); }
.sc-list .check-row { cursor: pointer; }
.sc-list .check-row:hover td { background: var(--pt-green-50); }
.sc-list .check-row:focus-visible { outline: 2px solid var(--pt-ink); outline-offset: -2px; }

.sc-detail { display: grid; gap: 14px; }
.sc-detail-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; font-size: 13px; color: var(--pt-slate); }
.sc-detail-table th.sc-c-mark { font-size: 12px; line-height: 1.25; white-space: normal; text-align: center; }
.sc-detail-table td.sc-c-mark { text-align: center; font-weight: 700; }
.sc-detail-table td.is-yes { color: var(--pt-green-700); }
.sc-detail-table td.is-no { color: #94a3b8; }
.sc-detail-table tr.is-skipped td { color: var(--pt-muted); }
.sc-pos { display: block; font-size: 12px; color: var(--pt-muted); }
.sc-detail-sec { border: 1px solid var(--pt-line); border-radius: 12px; overflow: hidden; }
.sc-detail-sec h4 { display: flex; justify-content: space-between; gap: 10px; margin: 0; padding: 10px 14px; background: #f8fafc; font-size: 13.5px; }
.sc-detail-sub { flex: none; font-weight: 600; color: var(--pt-slate); font-variant-numeric: tabular-nums; }
.sc-detail-sec ul { margin: 0; padding: 0; list-style: none; }
.sc-detail-sec li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; padding: 8px 14px; border-top: 1px solid var(--pt-line-soft); font-size: 13px; line-height: 1.5; }
.sc-detail-sec li.is-no { color: var(--pt-slate); }
.sc-yn { font-weight: 800; }
li.is-yes .sc-yn { color: var(--pt-green-700); }
li.is-no .sc-yn { color: #dc2626; }
.sc-checklist { display: grid; gap: 12px; }

/* --- Setup › Retail staff -------------------------------------------------------- */

.setup-saleman { display: grid; gap: 14px; }
.setup-seg { justify-self: start; }
.rs { display: grid; gap: 12px; }
.rs .panel-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.rs .btn.is-attention { box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.25); }
.rs-when { font-size: 14px; }
.rs-list { display: grid; gap: 8px; }
.rs-card { border: 1px solid var(--pt-line); border-radius: 12px; background: #fff; overflow: hidden; }
.rs-card.is-open { border-color: #cbd5e1; }
.rs-card-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 18px; align-items: center; gap: 12px; width: 100%;
  min-height: 52px; padding: 10px 14px; border: 0; background: none; font: inherit; text-align: left; cursor: pointer;
}
.rs-card-head:hover { background: #f8fafc; }
.rs-card-head svg { color: var(--pt-muted); transition: transform 0.15s ease; }
.rs-card.is-open .rs-card-head svg { transform: rotate(90deg); }
.rs-card-title { display: grid; gap: 1px; min-width: 0; }
.rs-card-title b { font-size: 14px; font-weight: 600; color: var(--pt-ink); }
.rs-card-title small { font-size: 12px; color: var(--pt-muted); }
.rs-count { font-size: 12.5px; font-weight: 600; color: var(--pt-slate); font-variant-numeric: tabular-nums; }
.rs-card-body { display: grid; gap: 10px; padding: 4px 14px 14px; border-top: 1px solid var(--pt-line-soft); }
.rs-checker { max-width: 320px; margin: 8px 0 0; }
.rs-people { display: grid; gap: 6px; }
.rs-person { display: grid; grid-template-columns: 24px minmax(0, 1.4fr) minmax(0, 1fr) 36px; align-items: center; gap: 8px; }
.rs-person-no { font-size: 12px; font-weight: 700; color: var(--pt-muted); text-align: right; }
.rs-person .field-input { min-height: 38px; }
.rs-card-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.rs-card-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.rs-import { display: grid; gap: 12px; }
.rs-import-table select { min-width: 220px; }
.rs-import-table select.is-unmatched { border-color: #f59e0b; background: #fffbeb; }
.rs-sub { display: block; font-size: 12px; color: var(--pt-muted); }
.rs-import-count { font-size: 13px; font-weight: 600; color: var(--pt-slate); }

/* --- narrower ------------------------------------------------------------------------ */

@media (max-width: 720px) {
  .sc-title { font-size: 19px; }
  .sc-tool { width: 44px; height: 44px; justify-content: center; padding: 0; }
  .sc-tool-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .sc-visit-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .sc-staff-fields { grid-template-columns: minmax(0, 1fr); }
  .sc-visit-fields .field:first-child { grid-column: 1 / -1; }

  /* A person is a card: name, then the eight as labelled chips, then the result and remark. */
  .sc-staff-wrap { overflow: visible; border: 0; background: none; }
  .sc-staff, .sc-staff tbody { display: block; }
  .sc-staff thead { display: none; }
  .sc-staff tr {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px;
    margin-bottom: 10px; padding: 12px; border: 1px solid var(--pt-line); border-radius: 14px; background: #fff;
  }
  .sc-staff td { display: block; padding: 0; border: 0; }
  .sc-staff td.sc-c-person { display: grid; grid-column: 1 / -1; margin-bottom: 4px; }
  .sc-staff td.sc-c-mark { width: auto; }
  .sc-mark {
    display: flex; width: 100%; height: auto; min-height: 44px; gap: 8px; justify-content: flex-start; padding: 8px 10px;
    border: 1px solid var(--pt-line); border-radius: 10px; background: #fff;
  }
  .sc-mark:has(input:checked) { border-color: #86efac; background: #f0fdf4; }
  .sc-mark-text { display: inline; font-size: 12.5px; font-weight: 600; color: var(--pt-ink); text-align: left; }
  .sc-staff td.sc-c-result { grid-column: 1 / -1; width: auto; }
  .sc-staff td.sc-c-remark { grid-column: 1 / -1; min-width: 0; }
  .sc-remark { min-height: 42px; }
  .sc-add .btn { flex: 1 1 100%; justify-content: center; min-height: 44px; }

  .sc-history-shop { flex: 1 1 100%; }
  .sc-list thead { display: none; }
  .sc-list, .sc-list tbody { display: block; }
  .sc-list tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 12px; border-bottom: 1px solid var(--pt-line-soft); }
  .sc-list td { display: block; padding: 0 !important; border: 0 !important; }
  .sc-list td:nth-child(2) { grid-column: 1; grid-row: 1; font-size: 14.5px; }
  .sc-list td:nth-child(1) { grid-column: 1; grid-row: 2; font-size: 12px; color: var(--pt-slate); }
  .sc-list td:nth-child(3) { grid-column: 1; grid-row: 3; font-size: 12px; color: var(--pt-muted); }
  .sc-list td:nth-child(4) { grid-column: 2; grid-row: 1; text-align: right; }
  .sc-list td:nth-child(5) { grid-column: 2; grid-row: 2 / 4; align-self: center; text-align: right; }
  .sc-detail-table thead { display: none; }
  .sc-detail-table, .sc-detail-table tbody { display: block; }
  .sc-detail-table tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px 8px; padding: 10px 12px; border-bottom: 1px solid var(--pt-line-soft); }
  .sc-detail-table td { display: block; padding: 0 !important; border: 0 !important; }
  .sc-detail-table td:first-child, .sc-detail-table td:nth-last-child(-n+2) { grid-column: 1 / -1; }
  .sc-detail-table td.sc-c-mark::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 600; color: var(--pt-muted); }

  .rs-person { grid-template-columns: 20px minmax(0, 1fr) 36px; }
  .rs-person .field-input + .field-input { grid-column: 2; grid-row: 2; }
  .rs-person .ucx-icon-btn { grid-column: 3; grid-row: 1 / 3; }
  .rs-card-actions .btn { flex: 1 1 auto; justify-content: center; min-height: 42px; }
  .rs-import-table select { min-width: 0; width: 100%; }
}

/* A person's name on one line where there is room. */
.sc-detail-table td:first-child { min-width: 150px; }

/* AM: each AM and how many shops; a name and that AM's shops ticked (2026-10-31). */
.rs-am-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 4px 0 10px; }
.rs-am-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--pt-line); border-radius: 999px; background: #fff; font: inherit; font-size: 13px; cursor: pointer; }
.rs-am-chip span { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--pt-green-50, #ecfdf5); color: var(--pt-green-700, #047857); font-weight: 700; text-align: center; }
.rs-am { display: grid; gap: 12px; }
.rs-am-ticks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.rs-am-tick { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 10px; border: 1px solid var(--pt-line); border-radius: 10px; background: #fff; cursor: pointer; font-size: 14px; }
.rs-am-tick.is-on { border-color: var(--pt-green-600, #059669); background: var(--pt-green-50, #ecfdf5); }
.rs-am-tick small { margin-left: auto; color: var(--pt-muted, #64748b); font-size: 12px; }
.rs-am-tick input { width: 18px; height: 18px; flex: none; }
