/*
 * ashfall-app2.css: page rules for the lane E2 bodies (guild, wars, lifeskill,
 * account, support, auth and admin). Loaded after ashfall-legacy.css by a link
 * at the top of each page template. Tokens only; every block is scoped to its
 * page class.
 */

/* ---- shared ---- */
/* A lead stat tile draws its figure at 56px, which breaks inside one 130px
   tile ("211.48 B", a countdown). On these pages it takes two tiles' width. */
.pg-guild .stats--tiles > .stat.is-lead,
.pg-scan .stats--tiles > .stat.is-lead,
.pg-warehouse .stats--tiles > .stat.is-lead,
.pg-referrals .stats--tiles > .stat.is-lead,
.pg-roster .stats--tiles > .stat.is-lead,
.pg-warboard .stats--tiles > .stat.is-lead,
.pg-score .stats--tiles > .stat.is-lead,
.pg-income .stats--tiles > .stat.is-lead,
.pg-admin .stats--tiles > .stat.is-lead { grid-column: span 2; }
.pg-guild .stats--tiles,
.pg-scan .stats--tiles,
.pg-warehouse .stats--tiles,
.pg-referrals .stats--tiles,
.pg-roster .stats--tiles,
.pg-warboard .stats--tiles,
.pg-score .stats--tiles,
.pg-income .stats--tiles,
.pg-admin .stats--tiles { grid-auto-flow: row dense; }
.pg-warehouse .stats .stat.is-lead b,
.pg-income .stats .stat.is-lead b,
.pg-scan .stats .stat.is-lead b { overflow-wrap: normal; }
/* At 320 a half width income tile has 108px for its figure, and a signed
   compact figure ("-470.29M") needs 119px at 27px, so its unit broke onto a
   line of its own. 24px fits it on one line. */
@media (max-width: 359px) {
  .pg-income .stats--tiles > .stat:not(.is-lead) b { font-size: 24px; }
}

/* ---- guild ---- */
/*
 * Guild pages (group guild): the guild hub, find a guild, the Discord bot page,
 * guild billing, and the war nights picker partial (also used by app/wars.php).
 * Every rule is scoped under .pg-guild, or under .wn-form for the partial, and
 * reads tokens only.
 */

/* field_error() prints .field-error; Ashfall styles only .field-err. */
.pg-guild .field-error,
.wn-form .field-error { color: var(--down); font-size: var(--fs-sm); margin: 0; }

/* A notice that ends a panel body should not push the panel open. */
.pg-guild .panel-b > .notice:last-child { margin-bottom: 0; }

/* Codes and ids: easier to read letter by letter. */
.pg-guild .mono,
.pg-guild .pg-guild-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.08em; }
.pg-guild .pg-guild-code { text-transform: uppercase; }

/* A second line under a name, in a table cell or a feed row. */
.pg-guild .pg-guild-sub { display: block; font-size: var(--fs-sm); color: var(--muted); font-weight: 400; white-space: normal; }

/* ---------------------------------------------------------------- the head */

.pg-guild .pg-guild-id { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.pg-guild .pg-guild-id > div { min-width: 0; }
.pg-guild .pg-guild-crest { flex: none; width: 56px; height: 56px; object-fit: cover; border: 1px solid var(--line-2); background: var(--panel-2); }
.pg-guild .pg-guild-crest--sm { width: 40px; height: 40px; }
.pg-guild .pg-guild-crest--mono { display: grid; place-items: center; font-family: var(--font-display); font-weight: var(--display-w); font-size: calc(26px * var(--dz)); color: var(--accent); }
.pg-guild .pg-guild-crest--sm.pg-guild-crest--mono { font-size: calc(18px * var(--dz)); }
.pg-guild .pg-guild-tags { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin: var(--sp-1) 0 0; color: var(--muted); }

/* The countdown in the lead stat tile: big digits, small unit letters. */
.pg-guild .pg-guild-clock { font-variant-numeric: tabular-nums; }
.pg-guild .stats .stat.is-lead b.pg-guild-clock { font-size: calc(36px * var(--dz)); overflow-wrap: normal; }
.pg-guild .pg-guild-clock i { font-style: normal; font-size: 0.5em; color: var(--muted); margin: 0 0.2em 0 0.05em; }
.pg-guild .pg-guild-clock.is-live { color: var(--up); }

/* ------------------------------------------------------------- the roster */

.pg-guild .pg-guild-who { display: inline-flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.pg-guild .pg-guild-who .who { display: grid; line-height: 1.2; min-width: 0; }
.pg-guild .pg-guild-who .who small { color: var(--muted); font-size: var(--fs-sm); }
.pg-guild .pg-guild-cls { flex: none; width: 26px; height: 26px; }
.pg-guild .pg-guild-cls--none { display: inline-block; border: 1px dashed var(--line-2); border-radius: 50%; }

/* The leave form sits on its own at the foot of the side column. */
.pg-guild .pg-guild-leave { margin-top: var(--gap-grid); }

/* ------------------------------------------------------------ find a guild */

/* Eight one-letter boxes for the join code. */
.pg-guild .code-entry { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: var(--sp-1); }
.pg-guild .code-entry input { width: 100%; min-width: 0; padding: 0; text-align: center; text-transform: uppercase; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: calc(20px * var(--dz)); }
.pg-guild .pg-guild-code-entry { border: 0; padding: 0; margin: 0; min-width: 0; }
.pg-guild .pg-guild-code-entry legend { padding: 0; margin-bottom: var(--sp-2); }

/* ---------------------------------------------------------- the Discord page */

.pg-guild .pg-guild-steps { display: grid; gap: var(--sp-2); padding-left: 1.4em; margin: 0 0 var(--sp-3); }
.pg-guild .pg-guild-steps .btn { margin-top: var(--sp-1); }
.pg-guild .pg-guild-teams .qty + small { display: block; margin-top: 2px; }

/* ---------------------------------------------------------------- billing */

.pg-guild .pg-guild-buy { display: grid; gap: var(--sp-2); justify-items: start; }
.pg-guild .pg-guild-pool { font-family: var(--font-display); font-weight: var(--display-w); font-size: calc(26px * var(--dz)); color: var(--accent); }
.pg-guild .pg-guild-pool.is-negative { color: var(--down); }
.pg-guild .pg-guild-h3 { margin: var(--sp-4) 0 var(--sp-2); padding-top: var(--sp-3); border-top: 1px solid var(--line); }
.pg-guild .plan.is-off { opacity: 0.6; }

/* ------------------------------------------- the war nights picker partial */

/* One night per row: the night and its stats, then the tier, then the cap.
   Grid rather than flex so the head row's labels sit over their columns. */
.wn-form .check-row { display: grid; grid-template-columns: minmax(0, 1fr) 10rem 6rem; gap: var(--sp-2) var(--sp-3); align-items: center; padding: var(--sp-2) 0; }
.wn-form .check-row + .check-row { border-top: 1px solid var(--line); }
.wn-form .check-row-main { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 0 var(--sp-2); min-width: 0; cursor: pointer; }
.wn-form .check-row-main input { margin-top: 3px; }
.wn-form .check-row-label { min-width: 0; }
.wn-form .check-row-stats { grid-column: 2; color: var(--muted); font-size: var(--fs-sm); }
.wn-form .check-row--head .check-row-main { display: block; }
.wn-form .check-row-tier select,
.wn-form .check-row-cap input { width: 100%; }
.wn-form .check-row-cap { text-align: right; }
.wn-form .check-row--head { padding-bottom: var(--sp-1); color: var(--muted); font-size: var(--fs-sm); }
.wn-form .check-row--head + .check-row { border-top: 0; }
.wn-form .check-row.is-muted { opacity: 0.55; }
.wn-form .check-row.is-muted .check-row-main { cursor: default; }
.wn-form .wn-help { margin: var(--sp-3) 0; }

/* Under 560px the night takes the full row and its tier and cap sit under it. */
@media (max-width: 560px) {
    .wn-form .check-row { grid-template-columns: minmax(0, 1fr) 6rem; }
    .wn-form .check-row-main { grid-column: 1 / -1; }
    .wn-form .check-row--head .check-row-main { display: none; }
}

/* ---- wars ---- */
/*
 * War pages (group wars): node wars, the war roster, war scores (list, board,
 * entry, leaderboard, player), the war map and the admin anchor board.
 * Every rule is scoped under .pg-wars, .pg-roster, .pg-scores, .pg-score,
 * .pg-warboard or .pg-warmap, and reads tokens only.
 */

/* ------------------------------------------------------------ node wars */

/* The signup answer: four one-button forms in an Ashfall .seg shell. The
   app.css .seg-signup look (rounded, padded, gradient) is reset here, and the
   divider moves to the form, since each button sits in its own form. */
.pg-wars .seg-signup { gap: 0; padding: 0; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 0; }
.pg-wars .seg-signup form { display: inline; }
.pg-wars .seg-signup form + form button { border-left: 1px solid var(--line-2); }
.pg-wars .seg-signup button { min-height: 44px; padding: 0 12px; border-radius: 0; background: none; color: var(--muted); font: inherit; font-weight: 500; box-shadow: none; }
.pg-wars .seg-signup button:hover { color: var(--ink); background: none; }
.pg-wars .seg-signup button[aria-pressed="true"],
.pg-wars .seg-signup button.is-active { background: var(--blood); color: var(--on-accent); font-weight: 600; box-shadow: none; }

.pg-wars .count { margin-right: var(--sp-2); white-space: nowrap; }
.pg-wars .count--in b { color: var(--up); }
.pg-wars .count--late b { color: var(--accent); }
.pg-wars .count--maybe b { color: var(--muted); }

.pg-wars .wars-rules { margin: 0; padding-left: var(--sp-5); color: var(--muted); }
.pg-wars .wars-rules li + li { margin-top: var(--sp-1); }

/* ----------------------------------------------------------- war roster */

.pg-roster .roster-list { list-style: none; margin: 0; padding: 0; }
.pg-roster .roster-list li { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); padding: 8px 0; border-top: 1px solid var(--line); }
.pg-roster .roster-list li:first-child { border-top: 0; }
.pg-roster .roster-side { color: var(--muted); font-size: var(--fs-sm); text-align: right; }
.pg-roster .roster-note { margin-left: var(--sp-2); padding: 1px 6px; border: 1px solid var(--line-2); border-radius: 0; color: var(--muted); font-size: var(--fs-xs); }

/* ----------------------------------------------------------- war scores */

.pg-scores .panel-b > * + *,
.pg-score .panel-b > * + *,
.pg-warboard .panel-b > * + * { margin-top: var(--sp-3); }

.pg-scores .field-error,
.pg-score .field-error,
.pg-warboard .field-error { color: var(--down); font-size: var(--fs-sm); margin: 0; }

.pg-scores .panel-b > .notice:last-child,
.pg-score .panel-b > .notice:last-child,
.pg-warboard .panel-b > .notice:last-child { margin-bottom: 0; }

/* The board's headers are its sort links: they read as headers, not links. */
.pg-score .ws-board th a.ws-sort { color: inherit; text-decoration: none; }
.pg-score .ws-board th a.ws-sort:hover,
.pg-score .ws-board th a.ws-sort.is-on { color: var(--accent); }
.pg-score .ws-board th a.ws-sort:hover { text-decoration: underline; }

/* The entry grid. Each input sits in a label whose text is for screen width
   only: hidden on the sheet, where the column head names the cell, and shown
   on the card layout below, where each row becomes a card of labelled cells so
   the fifteen columns never scroll sideways. */
.warscore-grid .ws-cell { display: block; }
.warscore-grid .ws-lab { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Heads wrap so fifteen columns fit a 960px sheet; narrower than that the
   sheet would scroll, so it turns into cards. */
.tbl.warscore-grid thead th { white-space: normal; vertical-align: bottom; line-height: 1.2; }
@container tw (max-width: 960px) {
  .tbl.warscore-grid,
  .tbl.warscore-grid tbody { display: block; width: 100%; }
  .tbl.warscore-grid thead { display: none; }
  .tbl.warscore-grid caption { display: block; text-align: left; }
  .tbl.warscore-grid tbody tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: var(--sp-2) var(--sp-3); padding: var(--sp-3) 0; border-top: 1px solid var(--line); }
  .tbl.warscore-grid tbody td { display: block; align-self: end; padding: 0; border: 0; white-space: normal; text-align: left; }
  .tbl.warscore-grid tbody td:first-child { grid-column: 1 / -1; }
  .tbl.warscore-grid .ws-lab { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; display: block; margin-bottom: 2px; color: var(--muted); font-size: var(--fs-xs); line-height: 1.25; }
  .tbl.warscore-grid input { width: 100%; min-width: 0; }
}

/* -------------------------------------------------------------- war map */

/* Map focus mode lets the page run the full width of the main column. */
.is-map-focus .pg-warmap { --wrap: none; }

.pg-warmap > .war-layout,
.pg-warmap > .notice { margin-top: var(--gap-grid); }
.pg-warmap > .war-aside { margin-top: var(--gap-grid); }

/* app.css gives the ops rail 340px tracks, wider than a 320px phone. */
.pg-warmap .war-ops { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }

/* The map takes the full width (owner, November 2026). One column at every
   width: the palette strip above the map, as the live site shows it under
   1100px, then the enemy board and the ops cards beneath. Shot-call mode keeps
   its own app.css order. */
.pg-warmap .war-layout:not(.is-shotcall) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas: "tools" "map" "board" "ops";
}
.pg-warmap .war-layout:not(.is-shotcall) .war-rail-tools .picker-filters { flex-direction: row; flex-wrap: wrap; align-items: center; }
.pg-warmap .war-layout:not(.is-shotcall) .war-rail-tools .war-chip { justify-content: center; }
.pg-warmap .war-layout:not(.is-shotcall) .war-rail-board .war-enemy-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
    gap: 4px var(--sp-4);
}
/* Wide and short windows keep the whole 4:3 map on screen, by the live
   site's allowance; under 1100px app.css lets it take the full width. */
@media (min-width: 1101px) {
    .is-map-focus .pg-warmap .war-layout:not(.is-shotcall) .war-map { width: min(100%, calc((100dvh - 265px) * 4 / 3)); }
}

.pg-warmap .panel-b > * + * { margin-top: var(--sp-3); }

/* The status badge keeps its badge--amber/neutral classes for app.js; these
   give them the Ashfall tag look. */
.pg-warmap .tag.badge--amber { background: none; color: var(--blood-hi); border-color: var(--blood); }
.pg-warmap .tag.badge--neutral { background: none; color: var(--muted); border-color: var(--line-2); }

.pg-warmap .war-credit { font-size: var(--fs-xs); }
.pg-warmap .war-fort-set { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1); }
.pg-warmap .war-plate-in { width: 6ch; }

/* The marker ledger is still a <details class="war-list card-body tight">
   because app.js opens it; it reads as an Ashfall fold here. */
.pg-warmap details.war-list { padding: 0; border-top: 1px solid var(--line); }
.pg-warmap details.war-list > summary { cursor: pointer; padding: var(--sp-2) 0; color: var(--muted); font-size: var(--fs-sm); }
.pg-warmap details.war-list > summary:hover { color: var(--ink); }

.pg-warmap-admin .war-palette { margin-bottom: var(--sp-3); }

/* ---- lifelog ---- */
/*
 * Lifeskill log pages (group lifelog): the gathering form, the log chooser
 * and its signed-out demo, the lifeskill history with its two list partials,
 * and the two quick log dialogs the recipe page opens. Page rules are scoped
 * under .pg-lifelog; the dialogs render on the recipe page, outside it, so
 * they are scoped under their own .ls-pop class. Tokens only.
 */

/* --------------------------------------------------------- gathering form */

/* The entry tables: a number box per row, kept narrow so the row fits. */
.pg-gather .ls-entry .tbl td .qty { width: 9ch; min-width: 6ch; }
.pg-gather .ls-entry .tbl td { vertical-align: middle; }
.pg-gather .ls-entry .tbl .item { min-width: 0; }
.pg-gather .ls-entry .tbl .item a { overflow-wrap: anywhere; }

/* Live figures that app.js marks while it recalculates. */
.pg-gather .ls-entry [data-line-value].silver { color: var(--accent); }
.pg-gather .ls-entry tr.is-highlight > td { background: var(--bg-2); }

/* A row addItemRow() adds carries the older row-sub note; keep it on its own line. */
.pg-gather .ls-entry .row-sub { display: block; font-size: var(--fs-sm); color: var(--muted); font-weight: 400; }

/* The search box and its suggestion list. */
.pg-gather .addrow .item-search { max-width: 420px; }
.pg-gather .addrow > p { margin: 0; font-size: var(--fs-sm); }
.pg-gather .chips--pick button:disabled { color: var(--muted); cursor: default; }

/* The empty table state and the method switch under it. */
.pg-gather .ls-empty { display: grid; gap: var(--sp-2); justify-items: center; text-align: center; }
.pg-gather .ls-empty .chips { justify-content: center; }
.pg-gather .ls-empty .chips li { border: 0; background: none; }

/* Hours and minutes side by side under one label. */
.pg-gather .ls-label { font-size: 0.875em; color: var(--muted); }
.pg-gather .ls-pair { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.pg-gather .ls-pair label { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--ink); font-size: 1em; }
.pg-gather .ls-pair .qty { width: 8ch; }

/* Folds sit in the same column rhythm as the panels. */
.pg-gather .col > .fold + .fold,
.pg-gather .col > .panel + .fold { margin-top: var(--gap-grid); }
.pg-gather .fold-b > p.dim { margin-bottom: var(--sp-3); }

/* The run summary on the right. */
.pg-gather .qlog-out b { overflow-wrap: anywhere; }
.pg-gather .col--stick .acts { margin-top: var(--sp-4); }
.pg-gather .ls-delete { margin-top: var(--gap-grid); }

/* On a 320px phone two number boxes per row only fit at six characters. */
@container tw (max-width: 400px) {
  .pg-gather .ls-entry .tbl td .qty { width: 5ch; min-width: 0; padding: 0 4px; }
}

/* ------------------------------------------------------- chooser and demo */

.pg-logpick .cards > .card > .i,
.pg-logdemo .cards > .card > .i { color: var(--accent); }
.pg-logpick .cards,
.pg-logdemo .cards { margin-bottom: var(--gap-grid); }
.pg-logdemo .cards > .card .facts { margin: 0; }
.pg-logdemo .cards > .card .tbl { margin: 0; }
.pg-logdemo .seal { margin-bottom: var(--gap-grid); }
.pg-logdemo > p.dim { font-size: var(--fs-sm); }

/* ---------------------------------------------------------------- history */

.pg-lshistory .notice { margin-bottom: var(--gap-grid); }
.pg-lshistory .tabs .dim { margin-left: var(--sp-1); font-variant-numeric: tabular-nums; }
.pg-lifelog .tbl .tag { white-space: nowrap; }

/* ------------------------------------------------ quick log dialogs (pops) */

/* app.css still styles .recipe-pop with a radius and a shadow; the Ashfall
   dialog has neither. */
dialog.modal.ls-pop { border-radius: 0; box-shadow: none; }
dialog.modal.ls-pop--wide { width: min(720px, calc(100% - 32px)); }
dialog.modal.ls-pop .modal-h h2 { overflow-wrap: anywhere; }
dialog.modal.ls-pop .modal-b > p { margin: 0; }
dialog.modal.ls-pop .ls-pop-h { font-size: var(--fs); color: var(--head); }
dialog.modal.ls-pop .ls-pop-acts,
dialog.modal.ls-pop .ls-pop-note { grid-column: 1 / -1; }
dialog.modal.ls-pop .ls-pop-note { font-size: var(--fs-sm); margin: 0; }
dialog.modal.ls-pop .stats { margin: 0; }

/* ---- lifestock ---- */
/*
 * Lifeskill stock pages (group lifestock): the income planner and its results
 * partial, the warehouse with its grid partial, the warehouse history, the
 * screenshot scan and the world map. Page rules are scoped under .pg-income,
 * .pg-warehouse, .pg-wh-history, .pg-scan and .pg-map. Tokens only.
 */

/* ------------------------------------------------------------ income page */

/* The recipe cell: pin star, name, tags and the margin bar in one column. */
.pg-income .pg-income-recipe { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); min-width: 0; }
.pg-income .pg-income-recipe .tag { font-size: var(--fs-sm); }

.pg-income .pg-income-pin { display: inline-grid; place-items: center; min-width: 32px; min-height: 32px; padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer; }
.pg-income .pg-income-pin:hover { color: var(--ink); }
.pg-income .pg-income-pin[aria-pressed="true"] { color: var(--accent); }
.pg-income .pg-income-pin:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* The share of the best margin, drawn under the recipe name. */
.pg-income .pg-income-bar { display: block; flex-basis: 100%; height: 3px; background: var(--line); }
.pg-income .pg-income-bar::before { content: ""; display: block; height: 100%; width: var(--bar, 0%); background: var(--accent); }

/* The ticked total beside the commit buttons. */
.pg-income .pg-income-bar-acts { align-items: center; }
.pg-income .pg-income-ticked { color: var(--muted); font-size: var(--fs-sm); }
.pg-income .pg-income-ticked b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* Advice and goals: the sentence, then its figures and actions under it. */
.pg-income .pg-income-advice li,
.pg-income .pg-income-goals li { display: grid; gap: var(--sp-1); }
.pg-income .pg-income-what { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-1) var(--sp-2); }
.pg-income .wb-advice-nodes { display: block; margin-top: 0; color: var(--muted); font-size: var(--fs-sm); }
.pg-income .wb-advice-nodes a { color: var(--accent); }
.pg-income .pg-income-advice .acts form { margin: 0; }

/* Storage rows: the unused note sits under the name, the remove button stays square. */
.pg-income .pg-income-unused { display: block; font-size: var(--fs-sm); }
.pg-income .pg-income-x { min-width: 44px; padding: 0; }
.pg-income .pg-income-held { display: inline-flex; align-items: center; gap: var(--sp-2); }
.pg-income [data-income-stock] .tbl td .qty { width: 10ch; min-width: 6ch; }
.pg-income [data-income-stock] .tbl td select { max-width: 14ch; }
.pg-income [data-income-grid] .tbl td,
.pg-income [data-income-commit] .tbl td { vertical-align: middle; }
.pg-income [data-income-commit] .tbl td .qty { width: 7ch; min-width: 5ch; }
@container tw (max-width: 400px) {
  .pg-income [data-income-stock] .tbl td .qty { width: 100%; min-width: 4ch; padding: 0 4px; }
  .pg-income [data-income-stock] .tbl td select { max-width: 9ch; }
}

/* --------------------------------------------------------- warehouse page */

/* .wb-assay and .wb-rail stay on these containers as app.js swap hooks.
   app.css still dresses both as the old workbench plates; undo that here so
   the Ashfall stats and panel inside them lay out on their own. */
.pg-warehouse .wb-assay { display: block; margin: 0 0 var(--sp-4); padding: 0; overflow: visible; background: none; border: 0; border-radius: 0; box-shadow: none; }
.pg-warehouse .wb-rail { display: block; }

.pg-warehouse .pg-warehouse-sort { justify-content: flex-end; margin-bottom: var(--sp-3); }

.pg-warehouse .whgrid li { position: relative; }
.pg-warehouse .whgrid li img { width: 44px; height: 44px; }
.pg-warehouse .whgrid li .tag { font-size: var(--fs-sm); }

.pg-warehouse .fold { margin-top: var(--sp-4); }
.pg-warehouse .pg-warehouse-unused { display: block; font-size: var(--fs-sm); }
.pg-warehouse [data-warehouse-form] .tbl td { vertical-align: middle; }
.pg-warehouse [data-warehouse-form] .tbl td .qty { width: 10ch; min-width: 6ch; }
.pg-warehouse [data-warehouse-form] .tbl td select { max-width: 14ch; }
.pg-warehouse [data-warehouse-form] .tbl td .btn { min-width: 44px; padding: 0; }
/* On a phone each edit row becomes a card: the item on its own line, then the
   count, the source, remove and the row button, so the inputs never scroll. */
@container tw (max-width: 600px) {
  .pg-warehouse [data-warehouse-form] .tbl,
  .pg-warehouse [data-warehouse-form] .tbl tbody { display: block; }
  .pg-warehouse [data-warehouse-form] .tbl thead { display: none; }
  .pg-warehouse [data-warehouse-form] .tbl caption { display: block; text-align: left; }
  .pg-warehouse [data-warehouse-form] .tbl tr.xr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto auto; align-items: center; gap: var(--sp-2); padding: var(--sp-2) 0; border-top: 1px solid var(--line); }
  .pg-warehouse [data-warehouse-form] .tbl tr.xr > td:not(.p2) { display: block; padding: 0; border: 0; }
  .pg-warehouse [data-warehouse-form] .tbl tr.xr > td:first-child { grid-column: 1 / -1; }
  .pg-warehouse [data-warehouse-form] .tbl td .qty,
  .pg-warehouse [data-warehouse-form] .tbl td select { width: 100%; min-width: 0; max-width: none; }
}

/* Recent movement: the change and the item on one line, the reason under it. */
.pg-warehouse .pg-warehouse-move { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); font-weight: 400; }
.pg-warehouse .pg-warehouse-move .delta { min-width: 7ch; }
.pg-warehouse .feed li { display: grid; gap: var(--sp-1); }
.pg-warehouse .feed li small { color: var(--muted); }
.pg-warehouse .feed li form { margin: 0; }

/* ------------------------------------------------------ warehouse history */

.pg-wh-history .pg-wh-history-item { display: inline-flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.pg-wh-history .pg-wh-history-item a { overflow-wrap: anywhere; }
.pg-wh-history .tbl td { vertical-align: middle; }

/* ----------------------------------------------------------- scan page */

/* .wb-hero-nav is the hook app.js follows after a save; app.css gives it a
   top margin meant for the old hero. */
.pg-scan .wb-hero-nav { margin-top: 0; }

/* app.js adds is-over while a file is dragged over the drop zone. */
.pg-scan .drop.is-over { border-color: var(--accent); background: var(--panel-2); }
.pg-scan .drop b { color: var(--ink); }

.pg-scan .pg-scan-busy { margin-top: var(--sp-3); }
.pg-scan [data-scan-status] { margin: var(--sp-2) 0 0; }

/* The calibration canvas scales to the column; app.js draws at its own size. */
.pg-scan .pg-scan-stage { margin: var(--sp-3) 0; border: 1px solid var(--line); background: var(--bg-2); overflow: hidden; }
.pg-scan .pg-scan-stage canvas { display: block; max-width: 100%; height: auto; cursor: crosshair; }
.pg-scan [data-scan-calibrate] .qty { width: 6ch; }

/* The review table app.js builds inside [data-scan-review]. */
.pg-scan [data-scan-review] table { width: 100%; border-collapse: collapse; }
.pg-scan [data-scan-review] th,
.pg-scan [data-scan-review] td { padding: var(--sp-2); border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.pg-scan [data-scan-review] input,
.pg-scan [data-scan-review] select { max-width: 100%; }

/* The waiting panel steps aside once the review panel is showing. */
.pg-scan [data-scan-review-panel]:not([hidden]) ~ .pg-scan-wait { display: none; }

/* ------------------------------------------------------------- map page */

/* The chips carry app.js's is-on class beside aria-pressed; style the pair. */
.pg-map .pg-map-chips .chip { font: inherit; color: var(--muted); background: none; border: 0; min-height: 44px; padding: 0 12px; cursor: pointer; }
.pg-map .pg-map-chips .chip.is-on { color: var(--accent); box-shadow: inset 0 -2px var(--accent); }

.pg-map .pg-map-bar { align-items: center; justify-content: space-between; margin-bottom: var(--sp-3); }
.pg-map .pg-map-bar .checks { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); margin: 0; }

/* The map takes the full width (owner, November 2026): the Find and spot
   panels that sat beside it go under it, side by side where they fit. */
.pg-map .cols--map { grid-template-columns: minmax(0, 1fr); }
.pg-map .cols--map > .col + .col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: var(--gap-grid);
    align-items: start;
}
.pg-map .cols--map > .col + .col > * { margin: 0; }

/* The frame anchors the docked node panel and plan readout. It runs to the
   panel's edges, so the map loses no width to the card's padding. */
.pg-map .node-map-frame { position: relative; margin-inline: calc(-1 * var(--pad-panel)); }
.pg-map .panel-b > .dim { margin: var(--sp-3) 0 0; }

.pg-map .war-map-toolbar .btn { min-width: 44px; padding: 0; }
.pg-map noscript .panel { margin-top: var(--sp-4); }
.pg-map noscript .acts form { margin: 0; }

/* ---- account ---- */
/*
 * Account pages (group account): support, support ticket, admin support queue
 * and ticket, profile, billing, billing return, groups, referrals, welcome.
 * Every rule is scoped under .pg-acct or a page class and reads tokens only.
 */

/* field_error() prints .field-error; Ashfall styles only .field-err. */
.pg-acct .field-error { color: var(--down); font-size: var(--fs-sm); margin: 0; }

/* DiscordAuth::mark() has no size of its own; app.css sized it only inside .btn--discord. */
.pg-acct .discord-mark { width: 18px; height: 14px; flex: none; fill: currentColor; }

/* A notice that ends a panel body should not push the panel open. */
.pg-acct .panel-b > .notice:last-child { margin-bottom: 0; }

/* Muted helper lines that sit between fields rather than under one. */
.pg-acct .pf-hint { font-size: var(--fs-sm); color: var(--muted); margin: 0; }

/* Second line under a name in a table cell or a checkbox label. */
.pg-acct .pf-sub,
.pg-groups .gr-sub { display: block; font-size: var(--fs-xs); color: var(--muted); font-weight: 400; white-space: normal; }

/* Join codes and similar: easier to copy letter by letter. */
.pg-groups .input--code { letter-spacing: 0.08em; text-transform: uppercase; }

/* Support ticket: the close form sits under the reply form. */
.pg-ticket .tk-close { margin-top: var(--sp-3); }

/* Billing. */
.pg-billing .bl-sup { margin-top: var(--sp-2); }
.pg-billing .plan.is-off { opacity: 0.6; }
.pg-billing .bl-buy { display: grid; gap: var(--sp-2); justify-items: start; }

/* Referrals: stacked forms inside one panel body. */
.pg-referrals .rf-gap { margin-top: var(--sp-3); }
.pg-referrals .rf-end { align-self: end; }

/* Profile. */
.pg-profile .pf-label { font-size: 0.875em; color: var(--muted); }
.pg-profile .pf-buffs { grid-column: 1 / -1; display: grid; gap: 0; }
.pg-profile .pf-buffs .pf-hint { margin-bottom: var(--sp-2); }
.pg-profile .form .check { align-items: flex-start; padding-top: var(--sp-2); }
.pg-profile .form .check input { margin-top: 2px; }
.pg-profile .pf-acts { display: inline-flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: flex-end; }
.pg-profile .pf-acts form { display: inline; }
.pg-profile .pf-folds { display: grid; margin: var(--sp-3) 0; }
.pg-profile .panel-b > * + * { margin-top: var(--sp-3); }
.pg-profile .pf-ident { display: flex; gap: var(--sp-3); align-items: center; }
.pg-profile .pf-ident img { border-radius: 50%; flex: none; }
.pg-profile .pf-region { display: inline-flex; gap: var(--sp-2); align-items: center; }
.pg-profile .pf-region select { width: auto; min-height: 36px; }
.pg-profile .facts dd { min-width: 0; overflow-wrap: anywhere; }
.pg-profile .pf-legal { font-size: var(--fs-sm); color: var(--muted); }
.pg-profile .pf-groups { list-style: none; margin: 0; padding: 0; display: grid; }
.pg-profile .pf-groups li { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); min-height: 44px; border-top: 1px solid var(--line); }
.pg-profile .pf-groups li:first-child { border-top: 0; }

/* Welcome: icon, heading, line and action stacked in each card. */
.pg-welcome .cards { margin-bottom: var(--sp-6); }
.pg-welcome .card .acts { margin-top: auto; }

/* ---- authlist ---- */
/*
 * Auth forms and admin list screens (group authlist): auth/login, register,
 * reset, invite, invite-signed-in, discord-complete, partials/consent, and
 * admin/users, guilds, groups, builds, news, durations, referrals, api-tokens,
 * war-scores with partials/admin-kind-tabs. Scoped under .pg-auth and
 * .pg-admin (plus the consent label's own .check--consent), tokens only.
 */

/* ---- Auth: the card body inside layout/auth ---------------------------- */

.pg-auth { display: grid; gap: var(--sp-4); min-width: 0; }
.pg-auth > h1 { margin: 0; }
.pg-auth > p { margin: 0; }
.pg-auth .form { margin: 0; }

/* The Discord mark inside a ghost button: .btn--discord no longer sizes it. */
.pg-auth .discord-mark { width: 18px; height: 14px; flex: none; }

/* "Signing up as X with Discord", with the avatar beside the name. */
.pg-auth-who { display: flex; gap: var(--sp-3); align-items: center; }
.pg-auth-who img { border-radius: 50%; flex: none; }

/* A guild's own description on its invite. */
.pg-auth-quote { border-left: 2px solid var(--line-2); padding-left: var(--sp-3); color: var(--muted); }

/* The consent tick wraps over two lines, so the box sits on the first. */
.check--consent { align-items: flex-start; font-size: var(--fs-sm); }
.check--consent input { margin-top: 2px; }

/* ---- Admin lists ------------------------------------------------------ */

.pg-admin .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: var(--fs-sm); overflow-wrap: anywhere; }

/* The line under a name in a table cell. */
.pg-admin .sub { display: block; font-size: var(--fs-xs); color: var(--muted); font-weight: 400; white-space: normal; }

/* A row's own form inside a table cell. */
.pg-admin .tbl form { margin: 0; }
.pg-admin .tbl .acts--sm { flex-wrap: wrap; }
.pg-admin .tbl select, .pg-admin .tbl input[type="text"] { width: auto; min-width: 0; }

/* Sub headings and notes inside a panel. */
.pg-admin .panel-b > h3 { font-size: var(--fs); margin: var(--sp-4) 0 var(--sp-2); }
.pg-admin .panel-b code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.95em; overflow-wrap: anywhere; }
.pg-admin .notice p + p { margin-top: var(--sp-2); }

/* Referral queues: one block per application or payout. */
.pg-admin .ref-item { display: grid; gap: var(--sp-3); padding-bottom: var(--sp-4); margin-bottom: var(--sp-4); border-bottom: 1px solid var(--line); }
.pg-admin .ref-item:last-of-type { border-bottom: 0; }
.pg-admin .ref-item h3 { margin: 0; font-size: var(--fs); }
.pg-admin .ref-facts { display: grid; gap: var(--sp-1); margin: 0; font-size: var(--fs-sm); }
.pg-admin .ref-facts > div { display: flex; gap: var(--sp-2); min-width: 0; }
.pg-admin .ref-facts dt { color: var(--muted); flex: 0 0 72px; }
.pg-admin .ref-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* API token scopes: one scope per line, grouped under a legend. */
.pg-admin fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
.pg-admin fieldset.field legend { padding: 0; font-size: var(--fs-sm); color: var(--muted); }
.pg-admin fieldset.field .checks { display: grid; gap: 0; }
.pg-admin fieldset.field .check { font-size: var(--fs-sm); align-items: flex-start; min-height: 36px; }
.pg-admin fieldset.field .check input { margin-top: 2px; }

/* ---- adminrec ---- */
/*
 * Admin record and admin data pages (group adminrec): admin/user, guild, group,
 * user-sessions, gear-piece, data, gear, news-edit and the two shared admin
 * partials. Everything is scoped under .pg-adminrec and reads tokens only.
 */

/* Raw column values, ids, slugs and cron lines. */
.pg-adminrec .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: var(--fs-sm); overflow-wrap: anywhere; }

/* The tag line under a record's heading. */
.pg-adminrec .page-h .sum-line { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; margin-top: var(--sp-2); }

/* A short explanation under a fact label or a name in a table cell. */
.pg-adminrec .sub { display: block; font-size: var(--fs-xs); color: var(--muted); font-weight: 400; white-space: normal; }
.pg-adminrec .facts dd { min-width: 0; overflow-wrap: anywhere; }
.pg-adminrec .facts dd.mono { font-weight: 500; }

/* Sub headings and operator notes inside a panel. */
.pg-adminrec .panel-b > h3 { font-size: var(--fs); color: var(--head); }
.pg-adminrec .hint { font-size: var(--fs-sm); color: var(--muted); }
.pg-adminrec .hint code, .pg-adminrec .panel-b code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.95em; overflow-wrap: anywhere; }

/* A row's own form inside a table cell: the inputs wrap instead of the table scrolling. */
.pg-adminrec .tbl td.fcell { white-space: normal; }
.pg-adminrec .tbl form { margin: 0; }
.pg-adminrec .rowform { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: flex-end; }
.pg-adminrec .rowform .mini { display: grid; gap: 2px; font-size: var(--fs-xs); color: var(--muted); }
.pg-adminrec .rowform .mini select { width: auto; }
.pg-adminrec .rowform .mini input[type="time"] { width: auto; }
.pg-adminrec .rowform .check { min-height: 40px; font-size: var(--fs-sm); }
.pg-adminrec .rowform .field-err { flex-basis: 100%; }

/* Read only command lines and the formatting help. */
.pg-adminrec pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg-2); border: 1px solid var(--line); padding: var(--sp-3); font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: var(--fs-xs); color: var(--ink); }
.pg-adminrec textarea.mono { font-size: var(--fs-sm); }

/* Headings inside a panel body sit closer to what they introduce. */
.pg-adminrec .panel-b > hr { border: 0; border-top: 1px solid var(--line); margin-block: var(--sp-4); }

/* The stat figure fields of one gear level. */
.pg-adminrec .statgrid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.pg-adminrec .statgrid .field.is-blank label { color: var(--muted); }
.pg-adminrec .fold summary .sub { display: inline; margin-left: var(--sp-2); }
