/* UK public bodies templates (tpl/public.js): councils, NHS, Parliament, public appointments */
body.ux.cec [hidden] { display: none !important; }

/* search + filter */
body.ux.cec .pub-search form, body.ux.cec .pub-filterrow form { display: flex; gap: 0.5rem; margin: 0; max-width: none; align-items: center; }
body.ux.cec .pub-search input:not([type=hidden]), body.ux.cec .pub-filterbar input { flex: 1; min-width: 0; height: 48px; padding: 0 1.1rem; font-size: 1rem; border-radius: 999px; border: 1px solid var(--c-line-strong); background: #fff; box-sizing: border-box; width: 100%; }
body.ux.cec .pub-search button { height: 48px; padding: 0 1.4rem; border-radius: 999px; background: var(--ux-ink); color: #fff; border: 0; font-weight: 700; cursor: pointer; }
html[data-cec="red"] body.ux.cec .pub-search button { background: var(--c-deep); }
body.ux.cec .pub-filterbar { margin: 0 0 1rem; }
body.ux.cec .pub-search .pub-filterbar { margin: 0.8rem 0 0; }
body.ux.cec .pub-filterrow select { flex: 1; min-width: 0; height: 48px; padding: 0 1rem; border-radius: 999px; border: 1px solid var(--c-line-strong); background: #fff; font-size: 0.95rem; max-width: 100%; }
body.ux.cec .pub-filtercard { margin-bottom: 0; }
body.ux.cec .pub-filtercard .pub-filterbar { margin: 0.8rem 0 0; }

/* tables: stack on phones so no column is dropped */
body.ux.cec .cec-table.pub-tbl .cec-strong a { font-weight: 700; }
body.ux.cec .cec-table.pub-tbl tr.past td { color: var(--ux-muted); }
body.ux.cec .cec-table.pub-tbl tr.pub-grp td { border-top: 0; padding: 1.1rem 0 0.35rem; background: transparent; font-size: 0.95rem; }
body.ux.cec .cec-table.pub-tbl tr.pub-grp:first-child td { padding-top: 0.2rem; }
body.ux.cec .cec-table.pub-tbl tr.pub-grp + tr td { border-top: 1px solid var(--c-line-strong); }
body.ux.cec .cec-table.pub-tbl td.cec-right { text-align: right; }
body.ux.cec .cec-table.pub-tbl th.cec-right { text-align: right; }
body.ux.cec .pub-tbl .tag { vertical-align: middle; }
body.ux.cec .pub-chair { background: var(--c-accent-tint, #fbe7e5); color: var(--c-accent-ink, #9a1b12); margin-left: 0.35rem; }

/* result lists, two-up lists of councils, chips */
body.ux.cec .pub-lists h3, body.ux.cec .pub-lists h4 { margin: 1.1rem 0 0.4rem; }
body.ux.cec .pub-lists > :first-child { margin-top: 0; }
body.ux.cec .pub-res, body.ux.cec .pub-cols { list-style: none; margin: 0; padding: 0; }
body.ux.cec .pub-res li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 0.6rem 0; border-top: 1px solid var(--c-line); font-size: 0.9rem; }
body.ux.cec .pub-res li:first-child { border-top: 0; padding-top: 0.1rem; }
body.ux.cec .pub-res-main { min-width: 0; }
body.ux.cec .pub-res li .pub-meta { color: var(--ux-muted); font-size: 0.8rem; text-align: right; }
body.ux.cec .pub-res li .pub-meta + .pub-meta { margin-left: 0; }
body.ux.cec .pub-cols { columns: 3 15rem; column-gap: 2rem; }
body.ux.cec .pub-cols li { break-inside: avoid; display: flex; justify-content: space-between; gap: 0.8rem; padding: 0.4rem 0; border-top: 1px solid var(--c-line); font-size: 0.9rem; }
body.ux.cec .pub-cols .pub-meta { color: var(--ux-muted); font-size: 0.78rem; white-space: nowrap; }
body.ux.cec .pub-sec > .cec-card h3 { margin-top: 1.4rem; }
body.ux.cec .pub-sec > .cec-card h3:first-of-type { margin-top: 0; }
body.ux.cec #pub-bodies .pub-sec { margin-bottom: 1.8rem; scroll-margin-top: 1rem; }
body.ux.cec #pub-bodies .pub-sec h3 { margin: 0 0 0.5rem; font-size: 1rem; }
body.ux.cec #pub-bodies .pub-sec h3 .muted { font-weight: 400; font-size: 0.8rem; margin-left: 0.3rem; }
body.ux.cec .pub-chips { margin-top: 0.8rem; }
body.ux.cec .pub-chips .chip { text-transform: none; letter-spacing: 0; }

/* bars (party composition etc.) */
body.ux.cec .pub-bars { display: flex; flex-direction: column; gap: 0.7rem; }
body.ux.cec .pub-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.2rem 0.8rem; align-items: center; font-size: 0.86rem; }
body.ux.cec .pub-bar .l { grid-column: 1; min-width: 0; overflow-wrap: anywhere; }
body.ux.cec .pub-bar .v { grid-column: 2; grid-row: 1; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
body.ux.cec .pub-bar .t { grid-column: 1 / -1; height: 8px; border-radius: 999px; background: var(--c-pale); overflow: hidden; }
body.ux.cec .pub-bar .t i { display: block; height: 100%; border-radius: 999px; background: #9a9ca0; }
body.ux.cec .pub-bar .t i.hi { background: var(--c-accent); }

/* sponsor jump list */
body.ux.cec .pub-jump { list-style: none; margin: 0; padding: 0; max-height: 34rem; overflow: auto; }
body.ux.cec .pub-jump li { display: flex; justify-content: space-between; gap: 0.8rem; padding: 0.4rem 0; border-top: 1px solid var(--c-line); font-size: 0.86rem; }
body.ux.cec .pub-jump li:first-child { border-top: 0; }

body.ux.cec .cec-page .cec-kv .ux-kv dd a { color: var(--c-accent-ink); font-weight: 700; overflow-wrap: anywhere; }
body.ux.cec .cec-page .cec-ph-text { overflow-wrap: anywhere; }

@media (max-width: 620px) {
  body.ux.cec .pub-search form, body.ux.cec .pub-filterrow form { flex-wrap: wrap; }
  body.ux.cec .pub-search button { flex: 1 0 100%; }
  body.ux.cec .cec-table.pub-tbl, body.ux.cec .cec-table.pub-tbl tbody, body.ux.cec .cec-table.pub-tbl tr { display: block; width: 100%; }
  body.ux.cec .cec-table.pub-tbl thead { display: none; }
  body.ux.cec .cec-table.pub-tbl tr { border-top: 1px solid var(--c-line); padding: 0.65rem 0; }
  body.ux.cec .cec-table.pub-tbl tr.pub-grp { border-top: 0; padding: 0.9rem 0 0.2rem; }
  body.ux.cec .cec-table.pub-tbl tr.pub-grp + tr { border-top: 1px solid var(--c-line-strong); }
  body.ux.cec .cec-table.pub-tbl td, body.ux.cec .cec-table.pub-tbl td:nth-child(n+4) { display: block; border: 0; padding: 0.08rem 0; width: auto; }
  body.ux.cec .cec-table.pub-tbl td:empty { display: none; }
  body.ux.cec .cec-table.pub-tbl tr:hover td { background: transparent; }
  body.ux.cec .cec-table.pub-tbl td[data-l]::before { content: attr(data-l) ": "; font-size: 0.66rem; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ux-muted); margin-right: 0.3rem; }
  body.ux.cec .cec-table.pub-tbl td.cec-right { text-align: left; }
    body.ux.cec .cec-table.pub-tbl td .tag { margin-left: 0; }
  body.ux.cec .cec-table.pub-memrec td:last-child, body.ux.cec .cec-table.pub-orgs td:last-child { margin-top: 0.15rem; }
  body.ux.cec .pub-res li { flex-wrap: wrap; gap: 0.15rem 0.8rem; }
  body.ux.cec .pub-res li .pub-meta { text-align: left; }
  body.ux.cec .pub-cols { columns: 1; }
  body.ux.cec .pub-jump { max-height: 22rem; }
}

/* fixes after first review */
body.ux.cec .pub-search .rec-search, body.ux.cec .pub-search form { border: 0 !important; border-top: 0 !important; box-shadow: none !important; padding: 0 !important; background: transparent !important; }
body.ux.cec .cec-searchcard .pub-filterbar { margin: 0.8rem 0 0; }
body.ux.cec .pub-cols li { border-top: 0; border-bottom: 1px solid var(--c-line); }
body.ux.cec .pub-filterrow form { border: 0 !important; box-shadow: none !important; padding: 0 !important; background: transparent !important; }
body.ux.cec .cec-card > p.cec-small + .table-scroll, body.ux.cec .cec-card > p.cec-small + .pub-lists { margin-top: 0.9rem; }
body.ux.cec .pub-memtbl td:last-child, body.ux.cec .pub-bodies td:last-child { white-space: nowrap; }

/* council map (councils list page only; public/councils-map.js) */
body.ux.cec aside.cec-col:has(> .cmap-card) { align-self: stretch; }
body.ux.cec .cmap-card { position: sticky; top: 87px; z-index: 5; }
body.ux.cec .cmap { height: clamp(320px, calc(100vh - 87px - 8.5rem), 640px); border-radius: 10px; overflow: hidden; background: var(--c-pale); isolation: isolate; border: 1px solid var(--c-line); }
body.ux.cec .cmap .leaflet-interactive { cursor: pointer; }
body.ux.cec .cmap-attr { margin: 0.6rem 0 0; line-height: 1.4; }
body.ux.cec .cmap-tip { font-family: inherit; font-size: 0.85rem; line-height: 1.35; border-radius: 6px; }
@media (max-width: 980px) {
  body.ux.cec aside.cec-col:has(> .cmap-card) { display: contents; }
  body.ux.cec .cmap-card { position: static; order: -1; }
  body.ux.cec .split-main > aside.cec-col > .card:not(.cmap-card) { order: 1; }
  body.ux.cec .cmap { height: 320px; }
}
body.ux.cec .cmap .leaflet-tile-pane { filter: grayscale(1) contrast(.9) brightness(1.08); opacity: .75; }

/* ward map (council detail page only; public/council-wards.js) */
body.ux.cec .cwmap-card { margin-top: 1.25rem; }
body.ux.cec .cwmap { height: 460px; border-radius: 10px; overflow: hidden; background: var(--c-pale); isolation: isolate; border: 1px solid var(--c-line); }
body.ux.cec .cwmap .leaflet-tile-pane { filter: grayscale(.85) contrast(.92) brightness(1.06); opacity: .8; }
body.ux.cec .cwmap .leaflet-interactive { cursor: pointer; }
body.ux.cec .cw-tip { white-space: normal; width: max-content; min-width: 190px; max-width: 280px; }
body.ux.cec .cw-tip .cw-p { color: var(--ux-muted); font-size: 0.8rem; }
body.ux.cec .cwmap-note { margin: 0.6rem 0 0; }
body.ux.cec .cw-legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; margin-top: 0.7rem; font-size: 0.85rem; }
body.ux.cec .cw-legend[hidden] { display: none !important; }
body.ux.cec .cw-key { display: inline-flex; align-items: center; gap: 0.4rem; }
body.ux.cec .cw-key i { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,.18); display: inline-block; }
body.ux.cec tr.cw-flash td { background: #fff3c4 !important; transition: background .3s; }
@media (max-width: 980px) { body.ux.cec .cwmap { height: 320px; } }

/* agent B 13 Oct: pill tab bars wrap on phones instead of scrolling out of sight */
@media (max-width: 700px) {
  body.ux.cec .cec-tabs { display: flex; flex-wrap: wrap; border-radius: 18px; overflow: visible; gap: 0.25rem; }
  body.ux.cec .cec-tabs a { flex: 0 0 auto; }
  body.ux.cec .hub-subnav { flex-wrap: wrap; overflow: visible; }
}
