/* ═══════════════════════════════════════════════════════════════════
   CHECK LIST SCREEN (cl-*) — the standalone Check List screen opened
   from Home, and the same screen opened inside a project.

   Deliberately a separate namespace from the older dc-* rules (spread
   across secondary-layout.css, operational-ui-polish.css and
   style.css): this screen was rebuilt, and reusing dc-* would have
   meant fighting four files' worth of inherited overrides. Colors all
   derive from --clr-primary so a company's branding color reaches this
   screen automatically. Every rule uses logical properties
   (inset-inline-*, padding-inline-*), so RTL needs no overrides.
   ═══════════════════════════════════════════════════════════════════ */

.cl-screen {
  background: var(--clr-bg, #f1f5f9);
}

.cl-header__title small {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--clr-text-muted, #94a3b8);
  margin-top: 1px;
}

.cl-body {
  padding: 14px 14px 90px;
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
}

/* ── Create section ───────────────────────────────────────────── */
.cl-create {
  background: var(--clr-surface, #fff);
  border: 1px solid var(--clr-border, #e2e8f0);
  border-radius: var(--radius-large, 16px);
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-card);
}

.cl-create__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.cl-create__title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--clr-text, #0f172a);
  letter-spacing: -.01em;
}

.cl-create__sub {
  margin: 3px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--clr-text-muted, #94a3b8);
}

.cl-create__custom {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

/* Horizontal rail on phones (thumb-swipe through the forms), wrapping
   grid from tablet up where there's room to show them all at once. */
.cl-template-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(196px, 1fr);
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.cl-template-rail::-webkit-scrollbar { height: 5px; }
.cl-template-rail::-webkit-scrollbar-thumb {
  background: var(--clr-border-2, #cbd5e1);
  border-radius: 99px;
}

.cl-tpl-card {
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 7px;
  text-align: start;
  padding: 12px;
  border-radius: var(--radius-card, 12px);
  border: 1px solid var(--clr-border, #e2e8f0);
  background: linear-gradient(160deg, var(--clr-surface-2, #f8fafc), var(--clr-surface, #fff));
  cursor: pointer;
  font-family: inherit;
  transition: border-color var(--dur-fast, 120ms) var(--ease-standard, ease),
              box-shadow var(--dur-fast, 120ms) var(--ease-standard, ease),
              transform var(--dur-fast, 120ms) var(--ease-standard, ease);
}

.cl-tpl-card:hover,
.cl-tpl-card:focus-visible {
  border-color: var(--clr-primary, #2563eb);
  box-shadow: var(--shadow-raised);
  transform: translateY(-2px);
  outline: none;
}

.cl-tpl-card:active { transform: translateY(0); }

.cl-tpl-card__icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--clr-primary, #2563eb);
  background: var(--clr-primary-lt, #e0ebff);
  flex-shrink: 0;
}

.cl-tpl-card__name {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--clr-text, #0f172a);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cl-tpl-card__meta {
  font-size: 11px;
  font-weight: 600;
  color: var(--clr-text-muted, #94a3b8);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.cl-tpl-card__tag {
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--clr-surface-3, #edf4fa);
  color: var(--clr-text-sub, #475569);
  font-size: 10px;
  font-weight: 700;
}

.cl-tpl-card--custom {
  border-style: dashed;
  background: var(--clr-surface, #fff);
}

/* ── Counters ─────────────────────────────────────────────────── */
.cl-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.cl-stat {
  appearance: none;
  border: 1px solid var(--clr-border, #e2e8f0);
  background: var(--clr-surface, #fff);
  border-radius: var(--radius-card, 12px);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color var(--dur-fast, 120ms) var(--ease-standard, ease),
              background var(--dur-fast, 120ms) var(--ease-standard, ease);
}

.cl-stat:hover { border-color: var(--clr-border-2, #cbd5e1); }

.cl-stat.is-active {
  border-color: var(--clr-primary, #2563eb);
  background: var(--clr-primary-lt, #e0ebff);
}

.cl-stat__num {
  font-size: 19px;
  font-weight: 800;
  line-height: 1;
  color: var(--clr-text, #0f172a);
}

.cl-stat--ok .cl-stat__num { color: var(--success, #059669); }
.cl-stat--pending .cl-stat__num { color: var(--warning, #d97706); }

.cl-stat__lbl {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--clr-text-muted, #94a3b8);
}

/* ── Toolbar ──────────────────────────────────────────────────── */
.cl-toolbar {
  background: var(--clr-surface, #fff);
  border: 1px solid var(--clr-border, #e2e8f0);
  border-radius: var(--radius-card, 12px);
  padding: 10px;
  margin-bottom: 12px;
}

.cl-toolbar__row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.cl-search {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.cl-search__icon {
  position: absolute;
  inset-inline-start: 10px;
  color: var(--clr-text-muted, #94a3b8);
  pointer-events: none;
}

.cl-search input {
  width: 100%;
  padding: 9px 12px;
  padding-inline-start: 32px;
  border-radius: var(--radius-control, 10px);
  border: 1px solid var(--clr-border, #e2e8f0);
  background: var(--clr-surface-2, #f8fafc);
  font-size: 13px;
  font-family: inherit;
  color: var(--clr-text, #0f172a);
}

.cl-search input:focus {
  outline: none;
  border-color: var(--clr-primary, #2563eb);
  background: var(--clr-surface, #fff);
  box-shadow: 0 0 0 3px var(--clr-primary-lt, #e0ebff);
}

.cl-search input::-webkit-search-cancel-button { display: none; }

.cl-search__clear {
  position: absolute;
  inset-inline-end: 8px;
  border: 0;
  background: transparent;
  color: var(--clr-text-muted, #94a3b8);
  font-size: 13px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.cl-toolbar__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 9px 12px;
  border-radius: var(--radius-control, 10px);
  border: 1px solid var(--clr-border, #e2e8f0);
  background: var(--clr-surface-2, #f8fafc);
  font-size: 12.5px;
  font-weight: 700;
  font-family: inherit;
  color: var(--clr-text-sub, #475569);
  cursor: pointer;
}

.cl-toolbar__toggle[aria-expanded="true"] {
  border-color: var(--clr-primary, #2563eb);
  color: var(--clr-primary, #2563eb);
  background: var(--clr-primary-lt, #e0ebff);
}

.cl-toolbar__badge {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--clr-primary, #2563eb);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.cl-filters {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.cl-filters.is-open { display: grid; }

.cl-select {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-control, 10px);
  border: 1px solid var(--clr-border, #e2e8f0);
  background: var(--clr-surface-2, #f8fafc);
  font-size: 12.5px;
  font-family: inherit;
  color: var(--clr-text-sub, #475569);
  font-weight: 600;
}

/* Period + exact-day picker: grouped in their own full-width row, ahead of
   the plain status/frequency/category selects, since picking a day is the
   filter that changes what the counters above mean (today vs a past date),
   not just what's visible in the list below. */
.cl-date-group {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-radius: var(--radius-control, 10px);
  background: var(--clr-surface-3, #eef2f7);
  border: 1px dashed var(--clr-border, #e2e8f0);
}

.cl-date-group__label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--clr-text-muted, #64748b);
  white-space: nowrap;
}

.cl-date-group .cl-select { width: auto; flex: 1 1 160px; }

.cl-date-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid var(--clr-border, #e2e8f0);
  background: var(--clr-surface-2, #f8fafc);
  color: var(--clr-text-sub, #475569);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.cl-date-clear:hover { background: var(--clr-danger-tint, #fee2e2); color: var(--clr-danger, #dc2626); }

.cl-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.cl-actions::-webkit-scrollbar { display: none; }

.cl-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  padding: 7px 11px;
  border-radius: 99px;
  border: 1px solid var(--clr-border, #e2e8f0);
  background: var(--clr-surface, #fff);
  font-size: 11.5px;
  font-weight: 700;
  font-family: inherit;
  color: var(--clr-text-sub, #475569);
  cursor: pointer;
  white-space: nowrap;
}

.cl-chip:hover {
  border-color: var(--clr-primary, #2563eb);
  color: var(--clr-primary, #2563eb);
}

.cl-chip.is-on {
  border-color: var(--clr-primary, #2563eb);
  background: var(--clr-primary-lt, #e0ebff);
  color: var(--clr-primary, #2563eb);
}

/* ── List ─────────────────────────────────────────────────────── */
.cl-list {
  display: grid;
  gap: 10px;
}

.cl-card {
  position: relative;
  background: var(--clr-surface, #fff);
  border: 1px solid var(--clr-border, #e2e8f0);
  border-radius: var(--radius-card, 12px);
  padding: 12px;
  cursor: pointer;
  transition: border-color var(--dur-fast, 120ms) var(--ease-standard, ease),
              box-shadow var(--dur-fast, 120ms) var(--ease-standard, ease);
}

.cl-card:hover {
  border-color: var(--clr-primary, #2563eb);
  box-shadow: var(--shadow-card);
}

.cl-card.is-complete { border-inline-start: 3px solid var(--success, #059669); }

.cl-card__top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.cl-card__title {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--clr-text, #0f172a);
  word-break: break-word;
}

.cl-card__badges {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.cl-badge {
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  white-space: nowrap;
}

.cl-badge--done { background: #dcfce7; color: #15803d; }
.cl-badge--freq { background: var(--clr-surface-3, #edf4fa); color: var(--clr-text-sub, #475569); }
.cl-badge--matrix { background: #ede9fe; color: #6d28d9; }

.cl-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--clr-text-muted, #94a3b8);
  margin-bottom: 9px;
}

.cl-card__meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.cl-progress {
  height: 5px;
  border-radius: 99px;
  background: var(--clr-surface-3, #edf4fa);
  overflow: hidden;
  margin-bottom: 4px;
}

.cl-progress__bar {
  height: 100%;
  border-radius: 99px;
  background: var(--clr-primary, #2563eb);
  transition: width var(--dur-base, 200ms) var(--ease-decel, ease);
}

.cl-card.is-complete .cl-progress__bar { background: var(--success, #059669); }

.cl-progress__label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--clr-text-muted, #94a3b8);
}

.cl-card__actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--clr-border, #e2e8f0);
  flex-wrap: wrap;
}

.cl-act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--clr-border, #e2e8f0);
  background: var(--clr-surface-2, #f8fafc);
  font-size: 11.5px;
  font-weight: 700;
  font-family: inherit;
  color: var(--clr-text-sub, #475569);
  cursor: pointer;
}

.cl-act:hover {
  border-color: var(--clr-primary, #2563eb);
  color: var(--clr-primary, #2563eb);
  background: var(--clr-surface, #fff);
}

.cl-act--primary {
  border-color: var(--clr-primary, #2563eb);
  background: var(--clr-primary, #2563eb);
  color: #fff;
  margin-inline-end: auto;
}

.cl-act--primary:hover {
  background: var(--clr-primary-dk, #1d4ed8);
  color: #fff;
}

.cl-act--danger:hover {
  border-color: var(--danger, #dc2626);
  color: var(--danger, #dc2626);
}

.cl-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 36px 20px;
  background: var(--clr-surface, #fff);
  border: 1px dashed var(--clr-border-2, #cbd5e1);
  border-radius: var(--radius-card, 12px);
}

.cl-empty svg { color: var(--clr-text-muted, #94a3b8); margin-bottom: 10px; }
.cl-empty strong { display: block; font-size: 14px; color: var(--clr-text, #0f172a); margin-bottom: 4px; }
.cl-empty small { font-size: 12px; color: var(--clr-text-muted, #94a3b8); line-height: 1.5; }

/* ── Pagination ───────────────────────────────────────────────── */
.cl-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.cl-page-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 9px;
  border-radius: 9px;
  border: 1px solid var(--clr-border, #e2e8f0);
  background: var(--clr-surface, #fff);
  font-size: 12.5px;
  font-weight: 700;
  font-family: inherit;
  color: var(--clr-text-sub, #475569);
  cursor: pointer;
}

.cl-page-btn.is-active {
  background: var(--clr-primary, #2563eb);
  border-color: var(--clr-primary, #2563eb);
  color: #fff;
}

.cl-page-btn:disabled { opacity: .45; cursor: default; }

.cl-page-info {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--clr-text-muted, #94a3b8);
  margin-inline: 6px;
}

/* ── Mobile FAB ───────────────────────────────────────────────── */
.cl-fab {
  position: fixed;
  inset-block-end: 78px;
  inset-inline-end: 16px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 0;
  background: var(--clr-primary, #2563eb);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-raised);
  cursor: pointer;
  z-index: 40;
}

.cl-fab svg { width: 22px; height: 22px; }
.cl-fab:active { transform: scale(.94); }

/* ── Floating scroll widget ───────────────────────────────────
   Shared rule (operational-ui-polish.css) pins it bottom-right, where
   it now sits on top of the mobile create FAB and the last card's
   action row. This screen is its only user, so it's re-anchored to the
   vertical middle of the viewport edge — clear of both. */
#screen-daily-checklist-templates .dc-floating-scroll-nav {
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
}

/* ── Tablet and up ────────────────────────────────────────────── */
@media (min-width: 700px) {
  .cl-body { padding: 18px 20px 40px; }

  .cl-template-rail {
    grid-auto-flow: row;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    grid-auto-columns: auto;
    overflow-x: visible;
  }

  .cl-stats { grid-template-columns: repeat(3, minmax(0, 190px)); }

  .cl-filters {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
  }

  /* Filters are always visible at this width, so the toggle is noise. */
  .cl-toolbar__toggle { display: none; }

  .cl-list { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }

  .cl-fab { display: none !important; }
}

@media (min-width: 1024px) {
  .cl-create { padding: 18px; }
  .cl-create__title { font-size: 16px; }
}

/* Equipment identity chips — shown under a routine's equipment heading and
   on work order cards, so a technician sees the code and room without
   opening the equipment record. */
.eq-identity-chips,
.dc-eq-identity {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.dc-eq-identity {
  padding: 0 4px 8px;
}

.eq-identity-chips .pg-chip,
.dc-eq-identity .pg-chip {
  padding: 4px 9px;
  font-size: 11.5px;
  border-radius: 999px;
  white-space: nowrap;
}