/* ══════════════════════════════════════════════════════════════════════════
   CHECKLIST CONFIGURATION — the shared per-module section (Stage 2)
   ══════════════════════════════════════════════════════════════════════════
   One stylesheet for all seven consumer modules, so the screen is visually
   identical wherever it is opened. Everything is scoped under `.cklcfg-scope`.

   Two house rules are load-bearing here (CLAUDE.md, "Colour pairs"):
   • index.html declares bare `button { background: var(--brand); color:#FFF
     !important; }`, so any control in this file must set BOTH colour and
     background, and must raise `color` to !important or its label renders
     white-on-white.
   • No literal hexes — every colour is a token (npm run brand-doctor).
   ────────────────────────────────────────────────────────────────────────── */

.cklcfg-scope { max-width: 900px; }

.cklcfg-lead {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--neutral);
  margin: 0 0 18px;
}

.cklcfg-loading,
.cklcfg-empty {
  padding: 26px 20px;
  text-align: center;
  border: 1px dashed var(--brand-a30);
  border-radius: 10px;
  background: var(--brand-tint);
  color: var(--neutral);
  font-size: 14px;
}
.cklcfg-hint {
  margin-top: 8px;
  font-size: 12.5px;
  line-height: 1.6;
  opacity: .8;
}

.cklcfg-group { margin-bottom: 18px; }

.cklcfg-gtitle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--neutral);
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--brand-a20);
}
.cklcfg-count {
  background: var(--brand-a15);
  color: var(--brand-dark);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 11px;
  letter-spacing: 0;
}

.cklcfg-list { display: grid; gap: 10px; }

/* A stated row, not a control. There is no Run action on this screen (see
   checklist-config.js), so the row must not look pressable: no pointer cursor,
   no hover lift. Colour is still declared as a PAIR out of habit and because a
   future state (e.g. "bound to a step") may add one. */
.cklcfg-scope .cklcfg-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  min-height: 56px;
  border: 1px solid var(--brand-a20);
  border-left: 4px solid var(--brand);
  border-radius: 10px;
  background: var(--card-bg, #fff);   /* brand-doctor-ok: neutral page white, not a brand colour */
  color: var(--text-strong, #1f2430) !important;  /* brand-doctor-ok: neutral body text, not a brand colour */
}

.cklcfg-card-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cklcfg-card-name { font-size: 15px; font-weight: 600; }
.cklcfg-card-desc {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--neutral);
  font-weight: 400;
}
.cklcfg-card-meta { display: flex; align-items: center; gap: 8px; margin-top: 2px; flex-wrap: wrap; }

.cklcfg-chip {
  background: var(--brand-a12);
  color: var(--brand-dark);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}
.cklcfg-ver { font-size: 11px; color: var(--neutral); font-weight: 600; }

.cklcfg-note {
  margin-top: 22px;
  padding: 12px 14px;
  border-left: 3px solid var(--info);
  background: var(--info-tint);
  border-radius: 0 8px 8px 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--neutral);
}

/* Phone: a long checklist name must wrap, never truncate to two words. */
@media (max-width: 600px) {
  .cklcfg-scope .cklcfg-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* ══ Workflow Checkpoints (Stage 3) ═══════════════════════════════════════
   Every control here declares colour AND background together, with `color`
   raised to !important — index.html's global `button { color:#FFF !important }`
   reaches these, and setting only one half is the white-on-white bug class
   CLAUDE.md documents. Each state carries its own :hover twin, or hover
   out-specifies the state and contradicts what the control means. */

.cklcfg-tabs { display: flex; gap: 4px; margin: 0 0 18px; border-bottom: 2px solid var(--brand-a20); }
.cklcfg-scope .cklcfg-tab {
  background: transparent !important; color: var(--neutral) !important;
  border: none; border-bottom: 3px solid transparent; border-radius: 6px 6px 0 0;
  padding: 9px 16px; font-size: 13.5px; font-weight: 600; cursor: pointer; margin-bottom: -2px;
}
.cklcfg-scope .cklcfg-tab:hover {
  background: var(--brand-tint) !important; color: var(--brand-dark) !important;
}
.cklcfg-scope .cklcfg-tab-on,
.cklcfg-scope .cklcfg-tab-on:hover {
  background: transparent !important; color: var(--brand-dark) !important;
  border-bottom-color: var(--brand);
}

.cklcfg-plantbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cklcfg-plantbar label { font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--neutral); }
.cklcfg-plantbar select {
  border: 1px solid var(--brand-a30); border-radius: 6px; padding: 7px 10px;
  font-size: 16px; background: #fff; /* brand-doctor-ok: neutral control ground */
}
.cklcfg-spacer { flex: 1; }

.cklcfg-scope .cklcfg-btn {
  background: #fff !important;                    /* brand-doctor-ok: neutral control ground */
  color: var(--brand-dark) !important;
  border: 1px solid var(--brand-a30); border-radius: 7px;
  padding: 8px 15px; font-size: 13px; font-weight: 600; cursor: pointer; min-height: 40px;
}
.cklcfg-scope .cklcfg-btn:hover {
  background: var(--brand-tint) !important; color: var(--brand-darker) !important;
}
.cklcfg-scope .cklcfg-btn-p,
.cklcfg-scope .cklcfg-btn-p:hover {
  background: var(--brand) !important; color: var(--brand-contrast) !important;
  border-color: var(--brand);
}
.cklcfg-scope .cklcfg-btn-p:hover { filter: brightness(.93); }

.cklcfg-phasebar { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.cklcfg-scope .cklcfg-phase {
  background: #fff !important;                    /* brand-doctor-ok: neutral control ground */
  color: var(--neutral) !important;
  border: 1px solid var(--brand-a20); border-radius: 999px;
  padding: 6px 15px; font-size: 12.5px; font-weight: 600; cursor: pointer; min-height: 36px;
}
.cklcfg-scope .cklcfg-phase:hover {
  background: var(--brand-tint) !important; color: var(--brand-dark) !important;
}
.cklcfg-scope .cklcfg-phase-on,
.cklcfg-scope .cklcfg-phase-on:hover {
  background: var(--brand) !important; color: var(--brand-contrast) !important;
  border-color: var(--brand);
}

/* Wide content scrolls inside its own box; the PAGE must never scroll sideways. */
.cklcfg-tablewrap { overflow-x: auto; border: 1px solid var(--brand-a20); border-radius: 8px; }
table.cklcfg-ruletable { width: 100%; border-collapse: collapse; font-size: 13px; }
table.cklcfg-ruletable th {
  background: var(--brand-tint); color: var(--brand-darker);
  font-size: 11px; font-weight: 700; text-align: left; padding: 9px 10px;
  border-bottom: 1px solid var(--brand-a20); white-space: nowrap;
}
table.cklcfg-ruletable td {
  padding: 10px; border-bottom: 1px solid var(--brand-a10);
  color: var(--text-strong, #1f2430);             /* brand-doctor-ok: neutral body text */
  vertical-align: middle;
}
table.cklcfg-ruletable tr:last-child td { border-bottom: none; }
.cklcfg-ruletable .cklcfg-c { text-align: center; }
.cklcfg-ruletable .cklcfg-cact { width: 56px; }
.cklcfg-ruletable input[type=checkbox] { width: 18px; height: 18px; cursor: pointer; }

.cklcfg-scope .cklcfg-icon {
  background: transparent !important; color: var(--danger) !important;
  border: none; cursor: pointer; font-size: 15px;
  min-width: 44px; min-height: 44px; border-radius: 6px;
}
.cklcfg-scope .cklcfg-icon:hover {
  background: var(--danger-tint) !important; color: var(--danger-dark) !important;
}

.cklcfg-pill {
  display: inline-block; font-size: 11px; padding: 2px 9px; border-radius: 999px;
  background: var(--neutral-tint); color: var(--neutral); margin: 1px 3px 1px 0; font-weight: 600;
}
.cklcfg-pill-on { background: var(--brand-a15); color: var(--brand-darker); }
.cklcfg-missing { color: var(--danger); font-size: 12px; }

/* Rule dialog */
.cklcfg-overlay {
  position: fixed; inset: 0; background: rgba(16,24,40,.55);
  display: flex; align-items: center; justify-content: center; z-index: 10060; padding: 16px;
}
.cklcfg-modal {
  background: #fff;                               /* brand-doctor-ok: neutral surface */
  border-radius: 12px; width: 100%; max-width: 440px;
  max-height: 88vh; display: flex; flex-direction: column; overflow: hidden;
}
.cklcfg-mhead { padding: 14px 18px; font-weight: 700; font-size: 15px;
  color: var(--brand-darker); border-bottom: 1px solid var(--brand-a20); }
.cklcfg-mbody { padding: 16px 18px; overflow-y: auto; }
.cklcfg-mfoot { padding: 12px 18px; display: flex; justify-content: flex-end; gap: 8px;
  border-top: 1px solid var(--brand-a20); }
.cklcfg-fld { margin-bottom: 14px; }
.cklcfg-fld > label { display: block; font-size: 12px; font-weight: 700; color: var(--neutral);
  margin-bottom: 5px; }
.cklcfg-fld select {
  width: 100%; border: 1px solid var(--brand-a30); border-radius: 6px;
  padding: 9px 10px; font-size: 16px;             /* 16px: smaller makes iOS Safari zoom */
  background: #fff;                               /* brand-doctor-ok: neutral control ground */
}
.cklcfg-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.cklcfg-chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
  font-weight: 500; color: var(--neutral); min-height: 32px; cursor: pointer; }
.cklcfg-chk input { width: 18px; height: 18px; }

@media (max-width: 720px) {
  .cklcfg-plantbar select { flex: 1 1 auto; }
  .cklcfg-scope .cklcfg-btn { flex: 0 0 auto; }
  /* The rule table has 5-9 checkpoint columns. Its wrapper already scrolls, but
     `width:100%` meant the table never exceeded the wrapper, so no scrollbar
     appeared and the right-hand checkpoints were unreachable on a phone — the
     admin could not tick Exit or Must-pass at all. A min-width lets the wrapper
     do its job; the PAGE still never scrolls sideways. */
  .cklcfg-tablewrap { -webkit-overflow-scrolling: touch; }
  table.cklcfg-ruletable { min-width: 680px; }
}

/* Edit sits beside Delete in the Action cell — both halves of the pair set. */
.cklcfg-scope .cklcfg-edit { color: var(--brand-dark) !important; }
.cklcfg-scope .cklcfg-edit:hover {
  background: var(--brand-tint) !important; color: var(--brand-darker) !important;
}
.cklcfg-ruletable .cklcfg-cact { width: 92px; white-space: nowrap; }
