/* ==========================================================================
   ACCOUNT, BILLING, PRICING AND FOUNDRY PAGES (everything on layouts/app.html
   except the dashboard and the project page).

   Loads after account.css, tones.css and dashboard.css (the fa* components
   themselves, in the dashboard's look, are in account.css). Two parts:
   1  fa* buttons inside .faDash;
   2  components for the pages rebuilt on the dashboard's classes
      (<div class="faDash pg">): page head, plan panels, meters, people lists.

   Type rule as in dashboard.css: nothing under 1rem in Bold; Medium (500) is
   the strongest small weight.
   ========================================================================== */

/* --- 1 · fa* buttons inside .faDash ---------------------------------------- */
/* links inside .faDash take --link-c; buttons keep their own colours */
.faApp .faDash a.faButton:link, .faApp .faDash a.faButton:visited { color: var(--on-highlight-color); }
.faApp .faDash a.faButton--ghost:link, .faApp .faDash a.faButton--ghost:visited { color: var(--ink); }

/* --- 2 · rebuilt pages ------------------------------------------------------ */
.faDash.pg { display: flex; flex-direction: column; gap: 20px; padding-top: 24px; }
.faDash.pg > .sec { margin-top: 20px; }
.pgHead { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px 24px; margin-bottom: 4px; }
.pgHead h1 { margin: 0; font-size: 1.75rem; font-weight: 700; letter-spacing: .01em; text-transform: uppercase; line-height: 1.1; }
.pgHead p { margin: 6px 0 0; color: var(--muted); font-size: .9rem; max-width: 62ch; }
.pgHead .pgActions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.pgCrumb { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 0 0 6px; display: flex; gap: 6px; align-items: center; }
.faApp .faDash .pgCrumb a { --link-c: var(--muted); --link-hover: var(--hl); }

.pgGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.pgGrid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pg .panel > p { margin: 0 0 10px; font-size: .85rem; }
.pg .panel > p:last-child { margin-bottom: 0; }
.pg .panel h3 svg.i { width: 16px; height: 16px; color: var(--muted); }
.pg .panel h3 .ttl { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 500; text-transform: uppercase; letter-spacing: .03em; }
.pg .panelActions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.pg .btn svg.i { width: 16px; height: 16px; }
.pg .btn.danger:hover, .pg .btn.danger.solid, .faDash .btn.danger:hover { color: var(--err-on); background: var(--err); box-shadow: none; }
.pg .btn.danger.solid:hover { filter: brightness(.92); }
.pg .btn.sm { padding: 6px 10px; font-size: .75rem; }
.pg form.inline { display: inline; margin: 0; }
.pg hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.pg .sub { font-size: .75rem; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 8px; }

/* plan panel: the name big, facts beside it */
.planBig { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 8px; }
.planBig b { font-size: 1.5rem; font-weight: 700; text-transform: uppercase; letter-spacing: .01em; line-height: 1.1; }
.planFacts { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 0 0 4px; padding: 0; list-style: none; }
.planFacts li { font-size: .75rem; padding: 3px 9px; border-radius: 99px; background: var(--bg); }
.planFacts li.ok { background: var(--ok-tint); color: var(--ok-text); }
.planFacts li.hl { background: var(--hl-tint); color: var(--hl-deep); }
.pg .panel > p.bigNum, .bigNum { font-size: 2.2rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.bigNum small { font-size: .8rem; font-weight: 400; color: var(--muted); margin-left: 6px; }

/* capacity meters */
.capMeters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 4px; }
.capMeter { padding: 12px 14px; border-radius: var(--r); background: var(--bg); }
.capMeter .lbl { display: flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.capMeter .lbl svg.i { width: 15px; height: 15px; }
.capMeter .val { margin: 6px 0 8px; font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.capMeter .val span { font-size: .8rem; font-weight: 400; color: var(--muted); }
.capMeter .bar { height: 6px; border-radius: 99px; background: var(--surface); overflow: hidden; }
.capMeter .bar i { display: block; height: 100%; border-radius: 99px; background: var(--hl); }
.capMeter small { display: block; margin-top: 6px; font-size: .75rem; color: var(--muted); }

/* people and guests */
.people { list-style: none; margin: 0; padding: 0; }
.people > li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: .85rem; }
.people > li:first-child { border-top: 0; }
.people .who { flex: 1; min-width: 0; }
.people .who b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people .who small { display: block; font-size: .75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people .acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; align-items: center; }
.people .empty { padding: 6px 0; }
.role { font-size: .75rem; padding: 2px 9px; border-radius: 99px; white-space: nowrap; background: var(--bg); color: var(--muted); }
.role.admin, .role.full { background: var(--hl-tint); color: var(--hl-deep); }
.role.contributor { background: var(--ok-tint); color: var(--ok-text); }
.role.pending { background: var(--warn); color: var(--warn-on); }
.guestProjects { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.guestProjects .chip form { display: inline-flex; margin: 0; }
.guestProjects .chip button { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; color: var(--muted); }
.guestProjects .chip button:hover { background: var(--err); color: var(--err-on); }
.guestProjects .chip button svg.i { width: 10px; height: 10px; stroke-width: 3; }
.faApp .pg .rowForm { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 0 0 12px; }
.faApp .pg .rowForm .faField { flex: 1 1 11rem; }
.faApp .pg .rowForm select, .faApp .pg .rowForm input { padding: .55em .7em; font-size: .9rem; }
.faApp .pg select.mini { width: auto; padding: .3em .5em; font-size: .8rem; }

/* pricing */
.faDash .faControls { margin-bottom: 4px; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 16px; }
.plan { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 20px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); outline: 1px solid var(--tone-line, var(--edge)); outline-offset: -1px; }
.plan[hidden] { display: none; }
.plan .tier { display: flex; align-items: center; gap: 10px; }
.plan .tier .tIco { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--tone-thumb, var(--bg)); color: var(--hand-line, var(--ink)); box-shadow: inset 0 0 0 1px var(--tone-line, var(--line)); }
.plan .tier .tIco svg.i { width: 20px; height: 20px; }
.plan h3 { margin: 0; font-size: 1rem; font-weight: 700; text-transform: uppercase; letter-spacing: .01em; }
.plan .price { margin: 4px 0 0; font-size: 2rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.plan .price small { font-size: .8rem; font-weight: 400; color: var(--muted); }
.plan .per { margin: 0; font-size: .75rem; color: var(--muted); }
.plan ul { flex: 1; margin: 4px 0; padding: 0; list-style: none; font-size: .82rem; }
.plan li { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-top: 1px solid var(--line); }
.plan li svg.i { flex: none; width: 15px; height: 15px; margin-top: 2px; color: var(--muted); }
.plan li.muted { color: var(--muted); }
.plan .btn { justify-content: center; }
.plan form { margin: 0; display: flex; }
.plan form .btn { flex: 1; }
.plan .teamTag { position: absolute; top: 14px; right: 14px; font-size: .75rem; padding: 2px 9px; border-radius: 99px; background: var(--hl-tint); color: var(--hl-deep); }
.freeBand { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: var(--r); background: var(--hl-tint); color: var(--hl-deep); font-size: .85rem; }
.freeBand svg.i { width: 22px; height: 22px; }
.freeBand span { flex: 1; }
.faApp .faDash .freeBand .link { --link-c: var(--hl-deep); }

/* subscription shop: the steps on the left, the total on the right */
.shop { display: grid; grid-template-columns: minmax(0, 1fr) minmax(17rem, 22rem); gap: 16px; align-items: start; }
.shopMain { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.faDash .shop h3 .ttl .stepNo { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--hl); color: var(--on-highlight-color); font-size: .75rem; font-weight: 700; letter-spacing: 0; }
.shop .optRow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.shop .faSegmented { background: var(--bg); filter: none; }
.planPicks, .addons { display: flex; flex-direction: column; gap: 8px; }
.planPick, .addon { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--r); box-shadow: inset 0 0 0 1.5px var(--line); }
.planPick { cursor: pointer; }
.planPick[hidden], .addon[hidden] { display: none; }
.planPick:hover { box-shadow: inset 0 0 0 1.5px var(--hl-soft); }
.planPick:has(input:checked), .addon.on { box-shadow: inset 0 0 0 2px var(--hl); background: var(--hl-tint); }
.planPick input { flex: none; margin: 0; accent-color: var(--hl); }
.planPick:has(input:focus-visible) { outline: 2px solid var(--hl); outline-offset: 2px; }
.shop .tIco { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--tone-thumb, var(--bg)); color: var(--hand-line, var(--ink)); box-shadow: inset 0 0 0 1px var(--tone-line, var(--line)); }
.shop .tIco svg.i { width: 18px; height: 18px; }
.shop .what { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.shop .what b { font-size: .9rem; font-weight: 700; text-transform: uppercase; letter-spacing: .01em; display: flex; align-items: center; gap: 8px; }
.shop .what small { font-size: .75rem; color: var(--muted); }
.planPick:has(input:checked) .what small, .addon.on .what small { color: var(--ink); }
.shop .teamTag { font-size: .7rem; font-weight: 400; text-transform: none; padding: 1px 8px; border-radius: 99px; background: var(--hl-tint); color: var(--hl-deep); }
.planPick:has(input:checked) .teamTag { background: var(--surface); }
.shop .cost { flex: none; font-size: 1rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; min-width: 6.5rem; }
.shop .cost small { font-size: .7rem; font-weight: 400; color: var(--muted); }
.shop .qty { flex: none; display: inline-flex; align-items: center; border-radius: var(--r); box-shadow: inset 0 0 0 1.5px var(--line); background: var(--surface); }
.shop .qty button { width: 32px; height: 34px; border: 0; background: none; color: var(--ink); font-size: 1.1rem; line-height: 1; cursor: pointer; border-radius: var(--r); }
.shop .qty button:hover { color: var(--hl); background: var(--hl-tint); }
.faApp .shop .qty input { width: 3rem; padding: 0; border: 0; box-shadow: none; background: none; text-align: center; font-size: .9rem; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.shop .qty input::-webkit-outer-spin-button, .shop .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.shopSum { position: sticky; top: calc(var(--railTop, 80px)); display: flex; flex-direction: column; gap: 12px; }
.shopSum .sumLines, .shopSum #cartAddonLines { display: flex; flex-direction: column; gap: 10px; }
.shopSum .sumLine { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: .85rem; font-variant-numeric: tabular-nums; }
.shopSum .sumLine > span:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.shopSum .sumLine b { font-weight: 500; }
.shopSum .sumLine small { font-size: .75rem; color: var(--muted); }
.shopSum .sumLine > span:last-child { white-space: nowrap; }
.shopSum .sumTotal { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .78rem; font-weight: 500; text-transform: uppercase; letter-spacing: .03em; }
.shopSum .sumTotal b { font-size: 1.6rem; font-weight: 700; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.shopSum .btn { justify-content: center; padding: 12px 14px; }
.shopSum .btn:disabled { opacity: .45; cursor: not-allowed; }
.pg .panel > p.note { color: var(--muted); font-size: .78rem; }

@media (max-width: 900px) {
	.pgGrid, .pgGrid.three { grid-template-columns: minmax(0, 1fr); }
	.capMeters { grid-template-columns: minmax(0, 1fr); }
	.pgHead .pgActions { margin-left: 0; }
	.people > li { flex-wrap: wrap; }
	.shop { grid-template-columns: minmax(0, 1fr); }
	.shopSum { position: static; }
	.people .acts { width: 100%; justify-content: flex-start; padding-left: 44px; }
}
@media (max-width: 560px) {
	.shop .optRow { grid-template-columns: minmax(0, 1fr); }
	.planPick, .addon { flex-wrap: wrap; }
	.shop .what { flex-basis: calc(100% - 100px); }
	.shop .cost { margin-left: auto; }
}

/* template builder (customtests/build_analysis_routines.html) */
.tplBuild { display: flex; flex-direction: column; gap: 16px; }
.tplBuild .panel { display: flex; flex-direction: column; gap: 12px; }
/* header: name, level, who; notes and look fold out below it */
.tplBuild .tplHead { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 16px; }
.tplHead .tplIco { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--tone-solid); color: var(--tone-ink); }
.tplHead .tplIco svg.i { width: 26px; height: 26px; }
.tplHead .tplFields { flex: 1; min-width: 260px; display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px 14px; align-items: start; }
.tplHead .tplFields .faHelp { display: none; }
.tplHead .tplMore { flex-basis: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.tplHead .tplMore[hidden] { display: none; }
/* one tile per category; a tile opens the drawer */
.tplBuild .slotSet { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tplBuild .slotSet[hidden] { display: none; }
.tplBuild .slotSet .note { grid-column: 1 / -1; margin: 0; }
.tplTile { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 14px; align-items: center; width: 100%; padding: 14px 16px; border-radius: var(--r-plus); background: var(--surface); box-shadow: var(--shadow); text-align: left; color: inherit; }
.tplTile:hover { background: var(--hl-tint); }
.tplTile .catIco { grid-row: span 2; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--hl-tint); color: var(--hl); }
.tplTile .catIco svg.i, .tplDrawer .catIco svg.i { width: 18px; height: 18px; }
.tplTile b { font-size: .72rem; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tplTile .rn { grid-column: 2; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tplTile .go { grid-row: 1 / 3; grid-column: 3; color: var(--hl); }
.tplTile .peek { grid-column: 2 / -1; margin-top: 6px; font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tplTile.isNone .rn { color: var(--muted); font-style: italic; }
.tplStd { display: inline-block; width: auto; margin-left: 6px; padding: 0 7px; border-radius: 99px; background: var(--hl-tint); color: var(--hl-deep); font-size: .68rem; font-weight: 500; font-style: normal; vertical-align: 2px; }
/* the drawer */
.tplDrawer { position: fixed; inset: 0 0 0 auto; width: min(520px, 100vw); max-width: none; max-height: none; height: 100vh; margin: 0; padding: 0; border: 0; background: var(--surface); color: var(--ink); box-shadow: -1rem 0 3rem #20008830; }
.tplDrawer::backdrop { background: #0b042055; }
.tplDrawer[open] { animation: tplSlide .22s cubic-bezier(.3, .7, .2, 1); }
@keyframes tplSlide { from { transform: translateX(40px); opacity: 0; } }
.tplDrawer .dIn { display: flex; flex-direction: column; height: 100%; }
.tplDrawer .dHead { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.tplDrawer .dHead h2 { flex: 1; margin: 0; font-size: 1.15rem; }
.tplDrawer .catIco { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--hl-tint); color: var(--hl); }
.tplDrawer .dX { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--bg); }
.tplDrawer .dBody { flex: 1; overflow-y: auto; padding: 16px 22px; display: flex; flex-direction: column; gap: 8px; }
.tplDrawer .dBody > .note { margin: 0; }
.tplDrawer .dFoot { display: flex; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); }
.tplDrawer .tplOpt { display: block; padding: 12px 14px; border-radius: var(--r); background: var(--bg); cursor: pointer; }
.tplDrawer .tplOpt[aria-checked="true"] { background: var(--surface); box-shadow: inset 0 0 0 2px var(--hl); }
.tplDrawer .tplOpt .oh { display: flex; align-items: baseline; gap: 10px; }
.tplDrawer .tplOpt .oh b { flex: 1; font-weight: 500; }
.tplDrawer .tplOpt .oh > span { color: var(--muted); font-size: .72rem; white-space: nowrap; }
.tplDrawer .tplOpt p { margin: 2px 0 0; font-size: .75rem; color: var(--muted); }
.tplDrawer .tplOpt .rtTests { margin-top: 8px; }
@media (prefers-reduced-motion: reduce) { .tplDrawer[open] { animation: none; } }
@media (max-width: 760px) { .tplBuild .slotSet, .tplHead .tplFields, .tplHead .tplMore { grid-template-columns: minmax(0, 1fr); } }
.rtTests { list-style: none; margin: 0; padding: 0; font-size: .82rem; }
.rtTests li { padding: 6px 0; border-top: 1px solid var(--line); }
.rtTests small { color: var(--muted); }
.tplBuild .lookFields, .csMore .lookFields { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.tplBuild .lookFields legend { padding: 0; margin-bottom: 4px; font-size: .75rem; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tplBuild .lookField, .csMore .lookField { display: flex; flex-direction: column; gap: 4px; }
.tplBuild .lookField label { font-size: .8rem; font-weight: 500; }
.tplBuild .lookField small { font-size: .75rem; color: var(--muted); }

/* --- custom testing overview (customtests/custom_tests.html, _item.html) ---------- */
.ctPage .pgActions { align-items: center; }

.ctBar { display: flex; flex-direction: column; gap: 12px; position: sticky; top: var(--railTop, 72px); z-index: 5; padding: 10px 0; background: var(--bg); }
.ctBar .tabs { display: flex; gap: 24px; flex-wrap: wrap; }
.ctBar .tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 0; border: 0; background: none; font: inherit; font-size: .9rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); cursor: pointer; }
.ctBar .tabs button[aria-pressed="true"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--hl); }
.ctBar .tabs button span { font-weight: 400; font-variant-numeric: tabular-nums; color: var(--muted); }
.ctFilters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; }
.ctFilters .faSegmented { filter: none; background: var(--surface); box-shadow: var(--shadow); }
.faApp .ctFilters select { width: auto; padding: .45em .7em; font-size: .85rem; }
.ctSearch { display: inline-flex; align-items: center; gap: 6px; flex: 1 1 14rem; max-width: 22rem; padding: 0 10px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); }
.ctSearch svg.i { width: 16px; height: 16px; color: var(--muted); flex: none; }
.faApp .ctSearch input { border: 0; box-shadow: none; background: none; padding: .55em 0; font-size: .9rem; width: 100%; }
.ctShown { margin: -8px 0 0; font-size: .75rem; color: var(--muted); }

.ctList { display: flex; flex-direction: column; gap: 8px; }
.ctList[hidden], .ctItem[hidden] { display: none; }
.ctItem { scroll-margin-top: 200px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); outline: 1px solid var(--edge); outline-offset: -1px; transition: box-shadow .2s; }
.ctItem[open] { box-shadow: var(--shadow-up); }
.ctItem.ctFlash { outline: 2px solid var(--hl); }
.ctItem > summary { display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; list-style: none; border-radius: var(--r); }
.ctItem > summary::-webkit-details-marker { display: none; }
.ctItem > summary:hover { background: var(--hl-tint); }
.ctItem > summary:focus-visible { outline: 2px solid var(--hl); outline-offset: 2px; }
.ctName { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ctName b { font-size: .9rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctName small { font-size: .75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctTags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ctTags .chip svg.i { width: 12px; height: 12px; }
.ctTags .chip.vis-public { background: var(--hl-tint); color: var(--hl-deep); }
.ctTags .chip.vis-foundry { background: var(--ok-tint); color: var(--ok-text); }
.ctCount { min-width: 6.5em; text-align: right; white-space: nowrap; font-size: .8rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.ctChev svg.i { width: 16px; height: 16px; color: var(--muted); transition: transform .2s; }
.ctItem[open] .ctChev svg.i { transform: rotate(180deg); }

.ctBody { display: grid; grid-template-columns: minmax(0, 1fr) minmax(14rem, 18rem); gap: 20px; padding: 6px 14px 16px 58px; }
.ctMain, .ctSide { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ctBody .sub { margin: 6px 0 0; }
.ctDesc { margin: 0; font-size: .85rem; }
.ctDef { display: grid; grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr); gap: 4px 16px; margin: 0; font-size: .82rem; }
.ctDef dt { color: var(--muted); }
.ctDef dd { margin: 0; overflow-wrap: anywhere; }
.ctFn { margin: 0; font-size: .75rem; color: var(--muted); }
.ctFn code { font-size: .75rem; }
.ctLinks { display: flex; flex-wrap: wrap; gap: 6px; }
.faApp .faDash .ctLinks a.chip { --link-c: var(--ink); }
.ctLinks a.chip:hover { box-shadow: inset 0 0 0 1px var(--hl); }
.ctTests { list-style: none; margin: 0; padding: 0; }
.ctTests li { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-top: 1px solid var(--line); font-size: .85rem; }
.ctTests li:first-child { border-top: 0; }
.ctTests li a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.faApp .faDash .ctTests li a { --link-c: var(--ink); }
.ctTests .meta { font-size: .72rem; color: var(--muted); }
.ctTests .ctPrivate { flex: 1; min-width: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fIco.sm { width: 24px; height: 24px; border-radius: 6px; }
.fIco.sm svg.i { width: 14px; height: 14px; }
.ctAdd { display: flex; gap: 8px; align-items: center; }
.faApp .ctAdd select { flex: 1; min-width: 0; padding: .45em .6em; font-size: .85rem; }
.ctSlots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ctSlot { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border-radius: var(--r); background: var(--bg); font-size: .85rem; min-width: 0; }
.ctSlot.empty { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.ctSlot .lbl { font-size: .7rem; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ctSlot small { font-size: .72rem; color: var(--muted); }
.faApp .ctSlot select { width: 100%; padding: .4em .5em; font-size: .85rem; }
.faApp .faDash .ctSlot a { --link-c: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctUse { margin: 0; font-size: .82rem; }
.ctActions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.ctActions form { margin: 0; }
.ctSide .note { margin: 4px 0 0; }
.faDash .btn.sm { padding: 6px 10px; font-size: .72rem; }
.faDash .btn.sm svg.i { width: 14px; height: 14px; }
.ctEmpty { text-align: center; padding: 24px 0; }

.ctDialog { width: min(36rem, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: var(--r); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-up); }
.ctDialog::backdrop { background: rgb(0 0 0 / .35); }
.ctPropsForm { display: flex; flex-direction: column; gap: 14px; padding: 20px 22px; }
.ctPropsForm h2 { margin: 0; font-size: 1rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
.ctPropsForm [hidden] { display: none !important; }
.ctVis { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.ctVis legend { margin-bottom: 6px; padding: 0; }
.ctVis label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; box-shadow: inset 0 0 0 1.5px var(--line); font-size: .82rem; cursor: pointer; }
.ctVis label:has(input:checked) { box-shadow: inset 0 0 0 2px var(--hl); background: var(--hl-tint); }
.ctVis label:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.ctVis input { accent-color: var(--hl); margin: 0; }
.ctVis svg.i { width: 14px; height: 14px; }
.ctDialog .lookPick { max-height: 11rem; overflow: auto; }
.ctToast { position: fixed; z-index: 60; left: 50%; bottom: 20px; transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: var(--r); background: var(--ink); color: var(--surface); font-size: .85rem; box-shadow: var(--shadow-up); }
.ctToast.bad { background: var(--err); color: var(--err-on); }

@media (max-width: 760px) {
	.ctBody { grid-template-columns: minmax(0, 1fr); padding-left: 14px; }
	.ctSlots { grid-template-columns: minmax(0, 1fr); }
	.ctItem > summary { flex-wrap: wrap; }
	.ctName { flex-basis: calc(100% - 60px); }
	.ctTags { justify-content: flex-start; margin-left: 44px; }
	.ctCount { display: none; }
	.ctBar { position: static; }
	.ctSearch { max-width: none; }
}

/* --- charset test (customtests/create_charset_test.html, static/js/charset_builder.js) --- */
.csForm { display: flex; flex-direction: column; gap: 16px; }
.csAbout { display: flex; flex-direction: column; gap: 12px; }
.csAboutGrid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px 16px; }
.csMore > summary { cursor: pointer; font-size: .8rem; font-weight: 500; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.csMore[open] { display: flex; flex-direction: column; gap: 12px; }
.csMore .lookFields legend { display: none; }
.csMore .lookField label { font-size: .8rem; font-weight: 500; }
.csMore .lookField small { font-size: .75rem; color: var(--muted); }
.csGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.csIn, .csOut { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.csOut { position: sticky; top: calc(var(--railTop, 72px)); max-height: calc(100vh - var(--railTop, 72px) - 24px); }
.csWay { display: flex; flex-direction: column; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.csIn h3 + .csWay { border-top: 0; padding-top: 0; }
.csWay .sub { margin: 0; }
.csRow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.csRow .note { margin: 0; flex: 1 1 14rem; }
.faApp .csWay textarea { width: 100%; font-family: inherit; font-size: .9rem; padding: .6em .7em; resize: vertical; }
.faApp .csRow select { flex: 1 1 12rem; min-width: 0; width: auto; padding: .5em .6em; font-size: .85rem; }
.csSearch { max-width: none; width: 100%; box-shadow: inset 0 0 0 1.5px var(--line); }
.csPage label.btn { cursor: pointer; }
.csPage input[type=file]:focus-visible + .note, .csPage label.btn:focus-within { outline: 2px solid var(--hl); outline-offset: 2px; }
.csResults { display: flex; flex-direction: column; max-height: 16rem; overflow: auto; border-radius: var(--r); box-shadow: inset 0 0 0 1px var(--line); padding: 4px; }
.csResults[hidden] { display: none; }
.csHit { display: flex; align-items: center; gap: 10px; width: 100%; padding: 5px 8px; border: 0; border-radius: 6px; background: none; font: inherit; text-align: left; color: var(--ink); cursor: pointer; }
.csHit:hover, .csHit:focus-visible { background: var(--hl-tint); }
.csHit.in { opacity: .55; }
.csHitT { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.csHitT b { font-weight: 500; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.csHitT small { font-size: .72rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.csHitAdd { flex: none; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--hl); }
.csHit.in .csHitAdd { color: var(--muted); text-transform: none; letter-spacing: 0; }
.csAll { align-self: flex-start; margin: 6px; }
.csG { flex: none; display: inline-grid; place-items: center; min-width: 2.2rem; height: 2.2rem; padding: 0 4px; border-radius: 6px; background: var(--bg); font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans", sans-serif; font-size: 1.25rem; line-height: 1; color: var(--ink); }
.csG.mark { color: var(--ink); }
.csG.space { font-family: inherit; font-size: .62rem; letter-spacing: .02em; color: var(--muted); text-transform: uppercase; box-shadow: inset 0 0 0 1px var(--line); background: none; }
.csPreview { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--r); background: var(--hl-tint); box-shadow: inset 0 0 0 1.5px var(--hl-soft); }
.csPreview[hidden] { display: none; }
.csPreviewHead { margin: 0; font-size: .9rem; }
.csPreviewHead b { font-weight: 700; }
.csChips { display: flex; flex-wrap: wrap; gap: 4px; max-height: 14rem; overflow: auto; }
.csChip .csG { background: var(--surface); min-width: 2rem; height: 2rem; font-size: 1.1rem; }
.csChips .csMore { align-self: center; font-size: .8rem; color: var(--muted); padding: 0 6px; }
.csProblems { margin: 0; padding: 8px 10px; list-style: none; border-radius: var(--r); background: var(--surface); font-size: .8rem; display: flex; flex-direction: column; gap: 4px; max-height: 10rem; overflow: auto; }
.csProblems[hidden] { display: none; }
.csProblems code { font-size: .78rem; padding: 1px 5px; border-radius: 4px; background: var(--bg); margin-right: 4px; }
.csTools .csSearch { flex: 1 1 10rem; width: auto; }
.faApp .csTools select { flex: 0 0 auto; }
.csList { list-style: none; margin: 0; padding: 0; overflow: auto; min-height: 6rem; }
.csList li { display: flex; align-items: center; gap: 10px; padding: 4px 0; border-top: 1px solid var(--line); font-size: .82rem; }
.csList li:first-child { border-top: 0; }
.csList code { flex: none; min-width: 5.5em; font-size: .78rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.csNa { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.csSave { position: sticky; bottom: 0; z-index: 4; padding: 12px 0; background: var(--bg); margin-top: 0; }
.csSave .note { margin: 0; }
@media (max-width: 900px) {
	.csGrid, .csAboutGrid { grid-template-columns: minmax(0, 1fr); }
	.csOut { position: static; max-height: none; }
	.csList { max-height: 60vh; }
}
.csWay .csSearch { flex: none; }


/* --- projects/publicNote.html --- */
.publicNote { --pnPad: 20px; --pnHover: color-mix(in srgb, var(--ink) 4%, var(--surface)); --pnHead: color-mix(in srgb, var(--ink) 8%, var(--surface)); --pnRule: color-mix(in srgb, var(--ink) 16%, transparent); padding: 6px 0; overflow: clip; }
.publicNote p { margin: 0; font-size: .95rem; line-height: 1.55; max-width: 70ch; }
.publicNote .pnEmpty { padding: 14px var(--pnPad); color: var(--muted); }

/* one part: text left, image or glyph right; a grey rule between two parts */
.pnItem { display: flex; flex-direction: column; gap: 10px; padding: 14px var(--pnPad); transition: background-color .15s; scroll-margin-top: 80px; }
.pnItem + .pnItem { border-top: 1px solid var(--pnRule); }
.pnItem:hover, .pnItem:focus-within { background: var(--pnHover); }
.pnItem:target { box-shadow: inset 3px 0 0 var(--hl); }
.pnItem.hasMedia { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: start; }
.pnText { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pnGlyph { font-weight: 600; }

/* images and glyphs: at most a quarter of the window high */
.pnMedia { max-width: 45vw; justify-self: end; }
.pnZoom { display: block; padding: 0; border: 0; background: none; color: inherit; cursor: zoom-in; border-radius: var(--r); }
.pnZoom:focus-visible { outline: 2px solid var(--hl); outline-offset: 3px; }
.pnZoom > img, .pnZoom .imgFig img { display: block; max-height: 25vh; max-width: 100%; width: auto; border-radius: var(--r); }
.pnZoom .imgFig { position: relative; display: inline-block; max-width: 100%; vertical-align: top; }
.pnZoom .imgFig svg, .pnPreview .imgFig svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pnGlyphSvg { display: block; height: 25vh; width: auto; max-width: 100%; aspect-ratio: 1; background: var(--bg); border-radius: var(--r); }

.publicNote .mk, .pnPreview .mk { fill: none; stroke: var(--hl); stroke-width: 3px; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.publicNote .num circle, .pnPreview .num circle { fill: var(--hl); }
.publicNote .num text, .pnPreview .num text { fill: var(--on-highlight-color); font-size: 40px; font-weight: 700; }
.publicNote .marks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: .9rem; }
.publicNote .marks li { display: flex; align-items: baseline; gap: 8px; }
.publicNote .marks .n { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--hl); color: var(--on-highlight-color); font-size: .7rem; font-weight: 700; }

/* the enlarged image or glyph, shown while the pointer is over it */
.pnPreview { position: fixed; z-index: 50; padding: 10px; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-up); outline: 1px solid var(--edge); pointer-events: none; color: var(--ink); }
.pnPreview img { display: block; max-width: min(70vw, 1100px); max-height: 80vh; width: auto; height: auto; border-radius: var(--r); }
.pnPreview .imgFig { position: relative; display: block; }
.pnPreview .pnGlyphSvg { height: min(75vh, 70vw); }

/* a heading folds its parts: 1.6 × the text, a lighter band over the whole width */
.pnSec > summary { display: flex; align-items: center; gap: 12px; padding: 12px var(--pnPad); background: var(--pnHead); cursor: pointer; list-style: none; }
.pnSec > summary::-webkit-details-marker { display: none; }
.pnSec > summary::before { content: ""; flex: none; width: .55em; height: .55em; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; font-size: 1.52rem; }
.pnSec:not([open]) > summary::before { transform: rotate(-45deg); }
.pnSec > summary:focus-visible { outline: 2px solid var(--hl); outline-offset: -2px; }
.pnSec h2 { margin: 0; font-size: 1.52rem; line-height: 1.2; font-weight: 700; text-transform: uppercase; }
.pnCount { margin-left: auto; font-size: .8rem; color: var(--muted); }
.pnSec + .pnSec, .pnItem + .pnSec { margin-top: 10px; }

/* comments on a part */
.pnCms > summary { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); cursor: pointer; list-style: none; }
.pnCms > summary::-webkit-details-marker, .pnReply > summary::-webkit-details-marker { display: none; }
.pnCms > summary::before { content: "+"; font-weight: 700; }
.pnCms[open] > summary::before { content: "−"; }
.pnCms > summary:hover { color: var(--ink); }
.pnThread, .pnReplies { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pnReplies { margin-left: 12px; padding-left: 12px; border-left: 2px solid var(--line); }
.pnCm .who { display: flex; align-items: center; gap: 6px; font-size: .8rem; }
.pnCm .team { font-size: .68rem; padding: 1px 6px; border-radius: 99px; background: var(--hl-tint); color: var(--ink); }
.pnCm .ago { color: var(--muted); }
.pnCm p { font-size: .9rem; margin-top: 2px; }
.pnReply > summary { font-size: .78rem; color: var(--hl); cursor: pointer; list-style: none; margin-top: 4px; width: max-content; }
.pnForm { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; max-width: 60ch; }
.pnForm input[type="text"], .pnForm textarea { font: inherit; font-size: .9rem; padding: 6px 9px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); }
.pnForm textarea { resize: vertical; min-height: 3.2em; }
.pnForm .btn { align-self: flex-start; }
.pnHp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 640px) {
	.publicNote { --pnPad: 14px; }
	.pnItem.hasMedia { grid-template-columns: 1fr; }
	.pnMedia { max-width: 100%; justify-self: start; grid-row: 1; }
}
@media (prefers-reduced-motion: reduce) { .pnItem, .pnSec > summary::before { transition: none; } }

/* --- wiki.html --- */
.faWikiSearch { width: 100%; margin-bottom: 1rem; }
.faWikiNav button { font: inherit; background: none; border: 0; cursor: pointer; padding: 0.35rem 0.8rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; color: var(--highlight-color); border-radius: var(--border-radius-plus); box-shadow: inset 0 0 0 2px var(--highlightminusminus-color); }
.faWikiNav button[aria-pressed="true"] { background: var(--highlight-color); color: var(--on-highlight-color); box-shadow: none; }
.faWikiEntry { scroll-margin-top: 5rem; margin-bottom: 1rem; }
.faWikiEntry:target { box-shadow: inset 0 0 0 3px var(--highlight-color); }
.faWikiEntry h3 { margin: 0 0 0.5rem; }
.faWikiEntry dl { margin: 0; }
.faWikiEntry dt { font-weight: 700; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.02em; margin-top: 0.6rem; }
.faWikiEntry dd { margin: 0.15rem 0 0; line-height: 1.45; }
.faWikiCode { font-family: monospace; margin-right: 0.5rem; }

/* --- small page helpers --- */
.pgGrid.pgGapTop { margin-top: 16px; }
.panel.panel--narrow { max-width: 40rem; }
