/* Area styles: characters and ledger (U35 story 4, U37). Tokens only. */

/* Character sheet (U37): a paper sheet of ruled, titled boxes. */
.wm-sheet { max-width: 64rem; }
.wm-sheet-header {
  border: 2px solid var(--wm-text); border-radius: var(--wm-radius-sm); background: var(--wm-surface-raised);
  padding: var(--wm-space-3) var(--wm-space-4); margin-bottom: var(--wm-space-3);
}
.wm-sheet-header h1 { font-family: var(--wm-font-heading); font-size: var(--wm-text-3xl); margin: 0; line-height: 1.15; }
.wm-sheet-header p { margin: var(--wm-space-1) 0 0; color: var(--wm-text-muted); }
.wm-sheet-grid { display: grid; gap: var(--wm-space-3); grid-template-columns: 1fr; align-items: start; }
.wm-sheet-box {
  border: 1px solid var(--wm-text); border-radius: var(--wm-radius-sm); background: var(--wm-surface-raised);
  padding: var(--wm-space-2) var(--wm-space-3); min-width: 0;
}
.wm-sheet-box p { margin: 0 0 var(--wm-space-1); }
.wm-sheet-box-title {
  font-family: var(--wm-font-heading); font-size: var(--wm-text-sm); text-transform: uppercase; letter-spacing: .06em;
  color: var(--wm-text-muted); margin: 0 0 var(--wm-space-1); padding-bottom: var(--wm-space-1); border-bottom: 1px solid var(--wm-border);
}
.wm-sheet-subtitle { font-family: var(--wm-font-heading); font-size: var(--wm-text-sm); margin: var(--wm-space-2) 0 var(--wm-space-1); }
.wm-sheet-coins-total { font-size: var(--wm-text-xl); font-weight: 600; line-height: 1.3; }
.wm-sheet-note { color: var(--wm-text-muted); font-size: var(--wm-text-sm); }
.wm-sheet-notice { border-color: var(--wm-warning); background: var(--wm-warning-bg, #fff8e1); }
.wm-sheet-notice .wm-sheet-box-title { color: var(--wm-warning); }
.wm-sheet-notice-text { margin-bottom: var(--wm-space-2); color: var(--wm-text); }
.wm-sheet-notice .btn { width: 100%; }
@media (min-width: 576px) { .wm-sheet-notice .btn { width: auto; min-width: 16rem; } }
.wm-sheet-table { width: auto; min-width: 60%; margin: 0; }
.wm-sheet-table th, .wm-sheet-table td { padding: var(--wm-space-1) var(--wm-space-2); }
.wm-sheet-table th:first-child, .wm-sheet-table td:first-child { width: 100%; }
.wm-sheet-ledger { list-style: none; margin: 0 0 var(--wm-space-1); padding: 0; font-size: var(--wm-text-sm); }
.wm-sheet-ledger li { padding: var(--wm-space-1) 0; }
.wm-sheet-date { color: var(--wm-text-muted); font-variant-numeric: tabular-nums; margin-right: var(--wm-space-1); }
@media (min-width: 768px) {
  /* Two balanced columns: boxes flow down the first, then the second. No box leaves a hole. */
  .wm-sheet-grid { display: block; column-count: 2; column-gap: var(--wm-space-3); }
  .wm-sheet-box { break-inside: avoid; margin-bottom: var(--wm-space-3); }
  .wm-sheet-full { column-span: all; }
}
/* U80: sheet page layout. Combat and Description share row 1; Inventory spans row 2. */
.wm-sheet--page { max-width: none; }
@media screen and (min-width: 768px) {
  .wm-sheet-layout { display: grid; grid-template-columns: 1fr 1fr; column-count: auto; column-gap: var(--wm-space-3); align-items: stretch; }
  .wm-sheet-layout > .wm-sheet-box { margin-bottom: 0; }
  .wm-sheet-layout > .wm-sheet-full { grid-column: 1 / -1; }
  .wm-sheet-inventory { overflow-x: visible; background: none; }
  .wm-sheet-inventory .wm-sheet-table { width: 100%; }
}
@media (max-width: 767.98px) {
  .wm-history-pager .btn { min-height: var(--wm-size-touch); display: inline-flex; align-items: center; }
  .wm-sheet-header h1 { font-size: var(--wm-text-2xl); }
}

/* Forms with a formset of item rows (adjust, consume, transfer). */
.wm-compact-list { max-width: var(--wm-size-narrow); }
.wm-recent-changes .wm-compact-list { max-width: none; }
.wm-short-field input { max-width: 8rem; }
.wm-available-items { max-width: var(--wm-size-narrow); }

/* Sheet helper text and point buttons (U84 B-23, B-68). */
.wm-sheet-point-actions { display: flex; flex-wrap: wrap; gap: var(--wm-space-1); margin-top: var(--wm-space-1); }
.wm-sheet-stats dd .wm-sheet-help { font-weight: 400; margin-top: var(--wm-space-1); }
.wm-sheet-shop form { justify-content: flex-start; }
.wm-sheet-shop .form-switch { margin: 0; }
@media (max-width: 575.98px) { .wm-sheet-shop .form-switch { padding-left: 0; } }

/* Slips picker (U84): 44 px tick targets. */
.wm-slips-picker td.wm-slips-tick { padding: 0; width: var(--wm-size-touch); }
.wm-slips-tick-label { display: flex; align-items: center; justify-content: center; width: var(--wm-size-touch); height: var(--wm-size-touch); cursor: pointer; margin: 0; }
.wm-slips-tick-label .form-check-input { width: 1.5rem; height: 1.5rem; margin: 0; }

/* Ledger history: signed amounts. The sign text carries the meaning; colour is an extra cue. */
.wm-credit { color: var(--wm-success); }
.wm-debit { color: var(--wm-danger); }
.wm-ledger-lines { list-style: none; margin: 0; padding: 0; }
.wm-history-pager { display: flex; gap: var(--wm-space-2); align-items: center; }

/* Item cards: trading-card size (2.5 x 3.5 in). Inch sizes are physical paper sizes, not tokens. */
.wm-item-card { width: 2.5in; height: 3.5in; box-sizing: border-box; overflow: hidden; font-size: 0.7rem; line-height: 1.2; padding: 0.12in 0.14in; display: flex; flex-direction: column; }
.wm-item-card-body { flex: 1; overflow: hidden; min-height: 0; }
.wm-item-card-footer { margin-top: auto; text-align: center; font-size: 0.85em; padding-top: 0.05in; }
.wm-item-card h2 { font-size: 1.7em; margin: 0 0 0.2em; text-align: center; line-height: 1.05; overflow-wrap: anywhere; }
.wm-item-card h2.wm-item-card-name--long { font-size: 1.3em; }
.wm-item-card h2.wm-item-card-name--xlong { font-size: 1.05em; }
.wm-item-card p { margin: 0 0 0.4em; }
.wm-item-card--full { width: 7.5in; height: 10.5in; font-size: 2.1rem; padding: 0.3in 0.36in; }
.wm-card-sheet { display: grid; grid-template-columns: repeat(3, 2.5in); grid-auto-rows: 3.5in; width: 7.5in; margin-bottom: var(--wm-space-4); }
.wm-card-cell { width: 2.5in; height: 3.5in; box-sizing: border-box; }

@media print {
  @page { margin: 12mm; }
  body { background: white; color: black; font-size: 10pt; }
  .wm-sheet { max-width: none; }
  .wm-sheet-header, .wm-sheet-box, .wm-item-card { background: white; border-color: black; box-shadow: none; break-inside: avoid; }
  .wm-sheet-header { padding: 4pt 8pt; margin-bottom: 6pt; }
  .wm-sheet-header h1 { font-size: 20pt; margin: 0; }
  .wm-sheet-header p, .wm-sheet-box-title, .wm-sheet-note, .wm-sheet-date { color: black; font-size: 10pt; }
  .wm-sheet-box-title { border-bottom-color: black; margin: 0 0 3pt; }
  /* U87: same two-column box grid as the screen */
  .wm-sheet-grid, .wm-sheet-layout { display: grid; grid-template-columns: 1fr 1fr; column-count: auto; gap: 6pt; align-items: stretch; }
  .wm-sheet-layout > .wm-sheet-full, .wm-sheet-grid > .wm-sheet-full { grid-column: 1 / -1; column-span: none; }
  .wm-sheet-box { margin: 0; padding: 4pt 6pt; }
  .wm-sheet-inventory, .wm-table-scroll { overflow: visible; background: none; }
  .wm-sheet-table { width: 100%; font-size: 10pt; }
  .wm-sheet-table th, .wm-sheet-table td { padding: 1pt 4pt; font-size: 10pt; }
  .wm-sheet-table td.num, .wm-sheet-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
  .wm-sheet-stats { font-size: 10pt; gap: 2pt 8pt; }
  .wm-sheet-ability-abbr, .wm-sheet-ability-mod, .wm-sheet-ledger { font-size: 10pt; }
  .wm-sheet-ability-score { font-size: 14pt; }
  .wm-sheet-coins-total { font-size: 14pt; }
  /* Beat the components.css `.table > thead > tr > th` 9pt (text-xs) rule. */
  .wm-sheet .wm-sheet-table.table > thead > tr > th { background: white; color: black; font-size: 10pt; }
  .wm-sheet-table tr { background: white; }
  .wm-sheet .wm-badge { border: 1px solid black; background: white; color: black; font-size: 10pt; }
  .wm-xp-bar { display: none; }
  .wm-xp-text { color: black; }
}

/* XP progress bar (gamification): slim bar under the XP number, text only in print. */
.wm-xp { margin-top: var(--wm-space-1); }
.wm-xp-bar {
  height: 6px;
  border: 1px solid var(--wm-border);
  border-radius: var(--wm-radius-sm, 3px);
  background: var(--wm-neutral-bg);
  overflow: hidden;
  width: 14rem;
}
.wm-xp-fill { height: 100%; width: 0%; background: var(--wm-accent); }
.wm-xp-text { margin: 0; font-size: var(--wm-text-sm); color: var(--wm-text-muted); }

/* U59: inventory row actions now live in components.css (U84 S1). */

/* U69: ability scores, combat stats and the sheet-style edit page */
.wm-sheet-abilities { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--wm-space-2); grid-template-columns: repeat(3, 1fr); }
.wm-sheet-ability { display: flex; flex-direction: column; align-items: center; padding: var(--wm-space-1); border: 1px solid var(--wm-border, currentColor); border-radius: var(--wm-radius-md, 6px); }
.wm-sheet-ability-abbr { font-size: var(--wm-text-sm); color: var(--wm-text-muted); font-weight: 600; }
.wm-sheet-ability-score { font-size: var(--wm-text-xl); font-weight: 600; line-height: 1.2; }
.wm-sheet-ability-mod { font-size: var(--wm-text-sm); font-variant-numeric: tabular-nums; }
.wm-sheet-stats { display: grid; grid-template-columns: auto 1fr; gap: var(--wm-space-1) var(--wm-space-3); margin: 0; }
.wm-sheet-stats dt { font-weight: 400; color: var(--wm-text-muted); }
.wm-sheet-stats dd { margin: 0; font-weight: 600; }
@media (min-width: 48rem) { .wm-sheet-abilities { grid-template-columns: repeat(6, 1fr); } }
.wm-sheet-ledger-box { margin-top: var(--wm-space-4); }
.wm-sheet-header-fields, .wm-sheet-abilities-form { display: grid; gap: var(--wm-space-2); grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); margin-top: var(--wm-space-2); }
.wm-sheet-abilities-form input[type=number] { max-width: 8rem; }
.wm-character-form textarea { width: 100%; }
/* U69: each edit input shows its saved value beside it. */
.wm-field-pair { display: grid; gap: 0 var(--wm-space-2); grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.wm-field-pair--wide { grid-template-columns: minmax(0, 1fr) minmax(0, 14rem); }
.wm-field-pair .wm-field { margin-bottom: 0; }
.wm-field-current { margin: var(--wm-space-2) 0 0; font-size: var(--wm-text-sm); color: var(--wm-text-muted); }
.wm-field-current-label { display: block; font-size: var(--wm-text-xs); text-transform: uppercase; letter-spacing: .05em; }
.wm-field-current-value { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 600; color: var(--wm-text); font-variant-numeric: tabular-nums; }
/* Long text (the description) wraps to three lines rather than one cut-off line. */
.wm-field-pair--wide .wm-field-current-value { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 39.999rem) {
  .wm-field-pair, .wm-field-pair--wide { grid-template-columns: minmax(0, 1fr); }
  .wm-field-current { margin-top: 0; }
}
@media print { .wm-sheet-ledger-box { display: none; } .wm-sheet-abilities { grid-template-columns: repeat(6, 1fr); } }

/* Character slips: 2 x 6 per portrait page. Inch sizes are physical paper sizes. Frame is .wm-pass in components.css. */
.wm-slip-sheet { display: grid; grid-template-columns: repeat(2, 4in); grid-auto-rows: 1.75in; width: 8in; margin-bottom: var(--wm-space-4); }
.wm-slip { display: grid; grid-template-columns: 1fr auto auto; overflow: hidden; padding: 0.1in 0.12in; font-size: 8pt; line-height: 1.2; }
.wm-slip-main { display: flex; flex-direction: column; min-width: 0; padding-right: 0.1in; }
.wm-slip-kicker { margin: 0; font-size: 7pt; font-variant: small-caps; letter-spacing: 0.08em; text-align: center; }
.wm-slip h2 { font-size: 18pt; margin: 0.02in 0 0; line-height: 1.05; }
.wm-slip h2.wm-slip-name--long { font-size: 14pt; overflow-wrap: anywhere; }
.wm-slip h2.wm-slip-name--xlong { font-size: 11pt; }
.wm-slip-pronouns, .wm-slip-player { margin: 0; font-size: 8pt; }
.wm-slip-pills { list-style: none; margin: 0.04in 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.04in; }
.wm-slip-pills .wm-pill { display: inline-flex; gap: 0.04in; border: 1px solid currentColor; border-radius: 0.1in; padding: 0 0.07in; white-space: nowrap; background: none; }
.wm-pill-label { font-size: 7pt; }
.wm-pill-value { font-size: 8.5pt; font-weight: 700; }
.wm-slip-foot { margin: auto 0 0; font-size: 7pt; font-variant: small-caps; letter-spacing: 0.08em; }
.wm-slip-abilities { display: grid; grid-template-columns: repeat(2, 0.55in); grid-template-rows: repeat(3, 1fr); gap: 0.05in; padding-left: 0.1in; align-content: center; }
.wm-slip-ability { display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid currentColor; border-radius: 0.05in; }
.wm-slip-ability-label { font-size: 7pt; font-weight: 700; }
.wm-slip-ability-score { font-size: 11pt; line-height: 1; }
.wm-slip-ability-mod { font-size: 8pt; }

.wm-item-card-brand { text-align: center; font-size: 0.85em; font-variant: small-caps; letter-spacing: 0.06em; margin: 0 0 0.2em; }
.wm-item-card-icon { text-align: center; font-size: 2em; line-height: 1; margin: 0 0 0.1em; }
.wm-item-card-pills { list-style: none; margin: 0 0 0.3em; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25em; }
.wm-item-card-pills .wm-pill { display: inline-flex; gap: 0.3em; border: 1px solid currentColor; border-radius: 1em; padding: 0 0.5em; white-space: nowrap; background: none; }
.wm-item-card .wm-pill-label { font-size: 0.8em; }
.wm-item-card .wm-pill-value { font-size: 0.95em; font-weight: 700; }
.wm-item-card-uses { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25em; margin: 0 0 0.4em; }
.wm-use-circle { display: inline-block; width: 0.9em; height: 0.9em; border: 1px solid currentColor; border-radius: 50%; background: transparent; }
.wm-inline-number { display: inline-block; width: 5em !important; vertical-align: baseline; }
