/* Custom lists (web/js/pages/lists.js), custom fields (pages/customfields.js, custom-fields-ui.js), addresses in parts and
   allergy lists on profiles (pages/office.js). Prefix cl- (lists), cf- (custom fields), alg- (allergies), addr- (addresses). */

/* ---- the library */
.cl-start { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.cl-tile { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.cl-tile:hover { border-color: var(--maroon-line); box-shadow: var(--shadow); }
.cl-tile > .jb-ico { width: 36px; height: 36px; padding: 8px; border-radius: 10px; background: var(--maroon-wash); color: var(--maroon-text); }
.cl-tile b { display: block; font-size: 15px; }
.cl-tile small { display: block; color: var(--ink-3); font-size: 13px; }
.cl-folders { flex: 0 1 240px !important; padding: 8px; position: sticky; top: calc(var(--jb-head, 0px) + 16px); }
.cl-folders a { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: var(--r-sm); color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 500; }
.cl-folders a:hover { background: var(--chip-soft); }
.cl-folders a[aria-current="page"] { background: var(--maroon-wash); color: var(--maroon-text); font-weight: 700; }
.cl-folders i { font-style: normal; color: var(--ink-3); font-size: 12px; font-weight: 600; }
.cl-row .cl-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--sage-mist); color: var(--sage-text); display: inline-flex; align-items: center; justify-content: center; flex: none; align-self: flex-start; }
.cl-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.cl-meta .jb-pill .jb-ico { width: 13px; height: 13px; vertical-align: -2px; margin-right: 2px; }
.cl-ai { display: flex; align-items: flex-end; gap: 12px; padding: 16px 18px; border-radius: var(--r); background: var(--ai-wash); border: 1px solid var(--ai-edge); }
.cl-ai .cl-ai-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--ai-tile); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: none; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.cl-ai label { display: flex; flex-direction: column; gap: 6px; }
.cl-ai .cl-ai-l { font-weight: 700; font-size: 15px; }
.cl-ai.compact { align-items: center; padding: 10px 12px; }
.cl-ai.compact .cl-ai-ico { width: 34px; height: 34px; }
@media (max-width: 640px) { .cl-ai { flex-wrap: wrap; } .cl-ai label { flex-basis: calc(100% - 52px); } .cl-ai .jb-btn { width: 100%; } }

/* ---- the builder */
.cl-build { display: flex; flex-direction: column; gap: 18px; }
.cl-crumb a { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; font-weight: 600; }
.cl-crumb .jb-ico { width: 16px; height: 16px; }
.cl-dirty { font-size: 13px; font-weight: 600; color: var(--amber-ink); background: var(--amber-tint); padding: 6px 10px; border-radius: 999px; }
.cl-step { display: flex; flex-direction: column; gap: 14px; }
.cl-stephead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cl-num { width: 26px; height: 26px; border-radius: 50%; background: var(--maroon); color: var(--on-maroon); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.cl-count { margin-left: auto; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 14px; border-radius: 999px; background: var(--sage-mist); color: var(--sage-ink); }
.cl-count b { font-weight: 700; }
.cl-count .cl-hint { color: var(--amber-ink); font-size: 13px; font-weight: 600; }
.cl-spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--sage-line); border-top-color: var(--sage); animation: cl-spin .7s linear infinite; }
@keyframes cl-spin { to { transform: rotate(360deg); } }
.cl-subjects button { min-height: 38px; padding: 0 16px; font-size: 14px; }
.cl-group { display: flex; flex-direction: column; gap: 10px; }
.cl-group.nested { margin-left: 4px; padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--sage-soft); border-radius: var(--r-sm); background: var(--chip-soft); }
.cl-group.nested.rel { border-left-color: var(--maroon-line); background: var(--maroon-wash); }
.cl-match { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); }
.cl-match select { min-height: 34px; padding: 0 8px; border: 1px solid #D5CFC2; border-radius: var(--r-sm); background: #fff; font-weight: 600; }
.cl-match .cl-x { margin-left: auto; }
.cl-gtag { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--sage-text); }
.cl-items { display: flex; flex-direction: column; gap: 8px; }
.cl-none { color: var(--ink-3); font-size: 14px; padding: 6px 0; }
.cl-cond { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--card); }
.cl-cond select, .cl-cond input, .cl-addcol select, .cl-sortrow select { min-height: 38px; padding: 0 10px; border: 1px solid #D5CFC2; border-radius: var(--r-sm); background: #fff; font-size: 14px; max-width: 100%; }
.cl-cond .cl-area { font-weight: 600; color: var(--sage-text); background: var(--sage-mist); border-color: var(--sage-line); }
.cl-cond .cl-field { font-weight: 600; min-width: 180px; }
.cl-cond .cl-op { color: var(--maroon-text); font-weight: 600; }
.cl-cond.missing { justify-content: space-between; }
.cl-pair { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; color: var(--ink-3); }
.cl-unit { display: inline-flex; align-items: center; border: 1px solid #D5CFC2; border-radius: var(--r-sm); background: #fff; overflow: hidden; }
.cl-unit input { border: 0 !important; min-width: 0; width: 150px; }
.cl-unit.number input, .cl-unit.money input, .cl-unit.percent input { width: 96px; }
.cl-unit i { font-style: normal; color: var(--ink-3); padding: 0 8px; background: var(--chip-soft); align-self: stretch; display: flex; align-items: center; font-size: 14px; }
.cl-n { width: 80px; }
.cl-chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.cl-chip { min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid #D5CFC2; background: #fff; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.cl-chip[aria-pressed="true"] { background: var(--sage); border-color: var(--sage); color: var(--on-sage); }
.cl-x { margin-left: auto; width: 34px; height: 34px; border-radius: var(--r-sm); border: 0; background: transparent; color: var(--ink-3); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.cl-x:hover { background: var(--maroon-wash); color: var(--maroon-text); }
.cl-x .jb-ico { width: 18px; height: 18px; }
.cl-add { display: flex; flex-wrap: wrap; gap: 6px; }
.cl-add .jb-btn { border: 1px dashed #CFC9BD; color: var(--ink-2); }
.cl-add .jb-btn:hover { border-color: var(--sage); color: var(--sage-text); background: var(--sage-mist); }
.cl-add .jb-btn .jb-ico, .cl-addcol .jb-btn .jb-ico { width: 16px; height: 16px; }
.cl-explainbox { align-items: center; }
.cl-explainbox > .jb-ico { color: var(--sage-text); }
.cl-colchips { display: flex; flex-wrap: wrap; gap: 8px; }
.cl-colchip { display: inline-flex; align-items: center; gap: 2px; min-height: 34px; padding: 0 4px 0 12px; border-radius: 999px; background: var(--maroon-wash); border: 1px solid var(--maroon-line); color: var(--maroon-text); font-size: 13px; font-weight: 600; }
.cl-colchip.fixed { padding-right: 12px; gap: 6px; background: var(--chip-soft); border-color: var(--line); color: var(--ink-2); }
.cl-colchip .jb-ico { width: 15px; height: 15px; }
.cl-colchip button { width: 26px; height: 26px; border: 0; background: transparent; border-radius: 50%; color: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.cl-colchip button:hover:not(:disabled) { background: rgba(0,0,0,.07); }
.cl-colchip button:disabled { opacity: .3; cursor: default; }
.cl-colchip > span { padding-right: 4px; }
.cl-addcol, .cl-sortrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.cl-addcol .cl-lbl { font-weight: 600; font-size: 14px; margin-right: 4px; }
.cl-sortrow label { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.cl-results { display: flex; flex-direction: column; gap: 12px; }
.cl-reshead { align-items: center; }
.cl-menuwrap { position: relative; }
.cl-menuwrap .jb-btn .jb-ico:last-child { width: 14px; height: 14px; margin-left: -2px; }
.cl-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 260px; padding: 6px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); box-shadow: 0 12px 32px rgba(0,0,0,.14); }
.cl-menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: transparent; border-radius: var(--r-sm); font-weight: 600; font-size: 14px; cursor: pointer; }
.cl-menu button:hover, .cl-menu button:focus-visible { background: var(--chip-soft); }
.cl-menu small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12.5px; }
.cl-tbl tr.cl-grp td { background: var(--sage-mist); border-bottom: 1px solid var(--sage-line); padding: 8px 12px; }
.cl-tbl tr.cl-grp b { color: var(--sage-ink); }
.cl-tbl tr.cl-grp span { color: var(--ink-3); font-size: 13px; margin-left: 6px; }
.cl-emptyres { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 30px 12px; color: var(--ink-3); text-align: center; }
.cl-emptyres .jb-ico { width: 28px; height: 28px; color: var(--sage-soft); margin-bottom: 4px; }
.cl-emptyres b { color: var(--ink-2); }
.cl-trunc { margin: 0; }
#cl-actions .jb-btn:disabled { opacity: .45; cursor: not-allowed; }
.cl-actnote { display: flex; align-items: flex-start; gap: 8px; margin: -2px 0 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--chip-soft); color: var(--ink-2); font-size: 13.5px; line-height: 1.45; }
.cl-actnote .jb-ico { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--sage-text); }
/* a list without names: the reason, the totals, then the other columns */
.cl-hidden { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--sage-mist); border: 1px solid var(--sage-line); }
.cl-hidden > .jb-ico { width: 22px; height: 22px; flex: none; color: var(--sage-text); margin-top: 1px; }
.cl-hidden b { display: block; color: var(--sage-ink); }
.cl-hidden span { display: block; font-size: 14px; color: var(--ink-2); line-height: 1.45; }
.cl-stats .jb-kpi .v { min-width: 0; }
.cl-tbl .cl-rowno { width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.cl-leftout { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line-soft); }
.cl-reach { padding: 12px 14px; border-radius: var(--r-sm); background: var(--chip-soft); font-size: 14px; line-height: 1.45; }
.cl-reach-names { margin-top: 2px; color: var(--ink-3); font-size: 13.5px; }
.cl-who { border: 0; padding: 0; margin: 0; gap: 8px; }
.cl-who .jb-check { align-items: flex-start; }
.cl-who .jb-check input { margin: 1px 0 0; flex: none; min-height: 0; height: 20px; width: 20px; padding: 0; }
.cl-who .jb-check > span { line-height: 22px; }
.cl-who small { font-weight: 400; }
.is-off { opacity: .55; }
@media (max-width: 640px) {
  .cl-cond > select, .cl-cond > .cl-pair, .cl-cond > .cl-unit, .cl-cond > .cl-chips { flex: 1 1 100%; }
  .cl-unit input { flex: 1; width: auto; }
  .cl-cond .cl-field { min-width: 0; }
  .cl-x { position: static; }
  .cl-count { margin-left: 0; }
  #cl-actions { width: 100%; }
}

/* ---- the Reports page's pointer to custom lists */
.rp-custom { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; padding: 12px; border-radius: var(--r-sm); background: var(--sage-mist); border: 1px solid var(--sage-line); color: var(--ink-2); text-decoration: none; font-size: 13px; }
.rp-custom b { display: block; color: var(--sage-ink); font-size: 14px; }
.rp-custom .jb-ico { color: var(--sage-text); }
.rp-custom:hover { border-color: var(--sage); }

/* ---- custom fields */
.cf-n { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--chip); color: var(--ink-3); font-size: 12px; text-align: center; margin-left: 2px; }
.cf-row { align-items: flex-start; }
.cf-move { display: inline-flex; flex-direction: column; gap: 4px; }
.cf-move .jb-iconbtn { width: 30px; height: 26px; }
.cf-move .jb-iconbtn .jb-ico { width: 15px; height: 15px; }
.cf-move .jb-iconbtn:disabled { opacity: .35; cursor: default; }
.cf-used { white-space: nowrap; align-self: center; }
.cf-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 34px 16px; text-align: center; color: var(--ink-3); }
.cf-empty > .jb-ico { width: 30px; height: 30px; color: var(--sage-soft); }
.cf-empty b { color: var(--ink-2); font-size: 16px; }
.cf-empty span { max-width: 420px; font-size: 14px; }
.cf-empty .jb-btn { margin-top: 8px; }
.cf-hidden { margin-top: 12px; border-top: 1px solid var(--line-soft); padding-top: 8px; }
.cf-hidden summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-3); padding: 6px 0; }
.cf-errs { margin: 8px 0 0; padding-left: 18px; color: var(--amber-ink); }
.cf-sub { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-top: 6px; }
.cf-val { white-space: normal !important; text-align: right; }
.cf-req { font-style: normal; font-size: 11px; font-weight: 700; color: var(--amber-ink); background: var(--amber-tint); padding: 2px 6px; border-radius: 999px; margin-left: 4px; }
.cf-multi { border: 0; padding: 0; margin: 0; }
.cf-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.cf-opt { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 1px solid #D5CFC2; border-radius: 999px; font-weight: 500; cursor: pointer; }
.cf-opt:has(input:checked) { background: var(--sage-mist); border-color: var(--sage); color: var(--sage-ink); }
.cf-opt input, .jb-field .cf-opt input { accent-color: var(--sage); width: 16px; height: 16px; min-height: 0; padding: 0; margin: 0; flex: none; }
.cf-opt span { white-space: nowrap; }
.cf-h { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.cf-sec + .cf-sec { border-top: 1px solid var(--line-soft); padding-top: 14px; }
.cf-mine { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 24px; }
.cf-mine-g { display: flex; flex-direction: column; }
.cf-mine-g > .jb-row-between { align-items: center; margin-bottom: 2px; }

/* ---- allergies on a student's profile and in the edit panel */
.alg-list { display: flex; flex-direction: column; gap: 6px; }
.alg-item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 14px; }
.alg-edit { border: 0; padding: 0; margin: 0; }
.alg-grid { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.alg-row { display: grid; grid-template-columns: minmax(150px, 1.2fr) minmax(130px, 1fr) minmax(120px, 1.4fr); gap: 8px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line-soft); }
.alg-row:last-child { border-bottom: 0; }
.alg-row select, .alg-row input:not([type=checkbox]) { min-height: 36px; padding: 0 8px; border: 1px solid #D5CFC2; border-radius: var(--r-sm); background: #fff; font-size: 14px; width: 100%; }
.alg-row:not(.on) select, .alg-row:not(.on) input:not([type=checkbox]) { visibility: hidden; }
.alg-row.on { background: var(--maroon-wash); }
@media (max-width: 640px) { .alg-row { grid-template-columns: 1fr 1fr; } .alg-row .jb-check { grid-column: 1 / -1; } .alg-row:not(.on) select, .alg-row:not(.on) input:not([type=checkbox]) { display: none; } }

/* ---- addresses in parts */
.addr-sz { display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; }
.addr-sz label { display: flex; flex-direction: column; gap: 5px; }
.addr-sz label > span { font-weight: 600; }
.addr-banner { margin-top: 4px; }
.addr-list { display: flex; flex-direction: column; gap: 16px; }
.addr-row { padding-bottom: 16px; border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 10px; }
.addr-row:last-child { border-bottom: 0; }
.addr-was { display: flex; flex-direction: column; gap: 2px; }
.jb-list > .cl-fhead { border-bottom: 0; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 18px 0 2px; }
.jb-list > .cl-fhead:first-child { padding-top: 2px; }
.cl-subjects { align-self: flex-start; }
.cl-sortrow select { max-width: 280px; }
.cf-card > .jb-row-between { align-items: center; margin: -6px 0 0; }
.alg-row { min-height: 44px; padding: 4px 10px; }
/* long field names wrap in the heading instead of stretching the column; names stay on one line */
.cl-tbl th { white-space: normal; min-width: 88px; max-width: 220px; vertical-align: bottom; line-height: 1.35; }
.cl-tbl th.num { white-space: normal; }
.cl-tbl td:first-child { white-space: nowrap; }
.cl-tbl td.nw { white-space: nowrap; }
@media (max-width: 640px) { .cl-build > .jb-page-head > .jb-inline { flex-shrink: 1; min-width: 0; max-width: 100%; } }
.cl-roles { padding: 2px 0 4px 28px; }
#cl-table > * + * { margin-top: 12px; }

/* a saved report opens as its results; Edit shows the steps that build it (pages/lists.js builder `viewing`) */
.cl-build.is-view .cl-editonly, .cl-build:not(.is-view) .cl-viewonly { display: none !important; }
.cl-who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--sage-mist); border: 1px solid var(--sage-line); font-size: 14px; color: var(--ink-2); }
.cl-wholbl { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.cl-wholbl .jb-ico { width: 14px; height: 14px; }
