/* ==========================================================================
   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. Two parts:
   1  the old fa* components (faCard, faButton, faTable …) restyled to the
      dashboard's look, so every small page (log in, confirm, forms) matches
      without changing its template;
   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* components in the dashboard's look ---------------------------- */
.faMain { padding-top: 2rem; }
.faMain--medium { max-width: 56rem; }

.faTitle { color: var(--ink); font-size: 1.75rem; font-weight: 700; letter-spacing: .01em; }
.faSectionTitle { color: var(--ink); font-size: 1rem; font-weight: 700; letter-spacing: .01em; }
.faLead { color: var(--muted); font-size: .9rem; }
.faLabel { color: var(--muted); font-weight: 500; letter-spacing: .04em; }

.faCard { filter: none; box-shadow: var(--shadow); outline: 1px solid var(--edge); outline-offset: -1px; padding: 1.5rem 1.6rem; }
@media (prefers-color-scheme: dark) { .faCard { box-shadow: var(--shadow); } }
.faCard--danger { box-shadow: var(--shadow), inset 0 0 0 2px var(--err); }

.faButton, .faApp a.faButton, .faApp a.faButton:visited { font-weight: 500; font-size: .78rem; padding: .75em 1.2em; border: 0; box-shadow: var(--shadow); }
.faButton--ghost, .faApp a.faButton--ghost, .faApp a.faButton--ghost:visited { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.faButton--ghost:hover, .faApp a.faButton--ghost:hover { background: var(--hl-tint); color: var(--hl-deep); box-shadow: inset 0 0 0 1.5px var(--hl-soft); }
.faButton--danger, .faApp a.faButton--danger { background: var(--err); color: var(--err-on); }
.faButton--small { font-size: .75rem; padding: .5em .85em; }
.faButton:disabled, .faButton[aria-disabled="true"] { box-shadow: none; }

.faTable th { color: var(--muted); font-weight: 500; letter-spacing: .04em; border-bottom: 1px solid var(--line); padding-bottom: .5rem; }
.faTable td { border-bottom-color: var(--line); vertical-align: middle; }
.faTable tr:last-child td { border-bottom: 0; }
.faPill { border-radius: 99px; font-weight: 500; font-size: .75rem; padding: .15em .7em; text-transform: none; }
.faPill--ok { background: var(--ok-tint); color: var(--ok-text); }
.faFacts dt { color: var(--muted); font-weight: 500; letter-spacing: .04em; }
.faNotice { box-shadow: var(--shadow); }
.faNotice--success { background: var(--ok-tint); color: var(--ok-text); }
.faNotice--error { color: var(--err-on); }
.faSegmented { filter: none; box-shadow: var(--shadow); }
.faSegmented button[aria-pressed="true"] { font-weight: 500; }
.faChecklist li::before { border-radius: 50%; width: .55em; height: .55em; top: .5em; }
.faAddon h3, .faPlanName { color: var(--ink); }
.faStepTitle::before { font-weight: 500; }
.faChoice { border-color: var(--line); }
.faCapacityItem .faLabel { color: var(--muted); }

/* 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 { color: var(--err-on); background: var(--err); box-shadow: none; }
.pg .btn.danger.solid { 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; }
.tplBuild .slotSet { display: flex; flex-direction: column; gap: 10px; }
.tplBuild .slotSet[hidden] { display: none; }
.tplBuild .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 { 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; }
.ctNew { position: relative; }
.ctNew > summary { list-style: none; cursor: pointer; }
.ctNew > summary::-webkit-details-marker { display: none; }
.ctNewMenu { position: absolute; z-index: 20; right: 0; top: calc(100% + 6px); min-width: 14rem; padding: 6px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-up); outline: 1px solid var(--line); outline-offset: -1px; display: flex; flex-direction: column; }
.faApp .faDash .ctNewMenu a { padding: 8px 10px; border-radius: 6px; font-size: .85rem; --link-c: var(--ink); }
.ctNewMenu a:hover, .ctNewMenu a:focus-visible { background: var(--hl-tint); }

.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; }
.faDash .btn.danger:hover { color: var(--err-on); background: var(--err); box-shadow: none; }
.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 { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.csMore .lookFields legend { display: none; }
.csMore .lookField { display: flex; flex-direction: column; gap: 4px; }
.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; }
