:root {
  color-scheme: dark light;
  --layout-max: min(96vw - 2.5rem, 1400px);
  --sheet-radius-section: 3px;
  --sheet-radius-control: 4px;
  --sheet-font-ui: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sheet-font-mono: ui-monospace, "Cascadia Mono", "Consolas", "Liberation Mono", monospace;
  --weapon-pct-col: 4.5rem;
  --weapon-expense-col: 6.25rem;
  /* Dark (domyślny) */
  --sheet-bg: #0e1318;
  --sheet-surface: #171e27;
  --sheet-line: #2a3442;
  --sheet-text: #e8eef4;
  --sheet-muted: #8b98a8;
  --sheet-accent: #4a9eff;
  --sheet-danger: #d45555;
  --sheet-focus: #7ec8ff;
  --sheet-row-alt: rgba(255, 255, 255, 0.04);
  --sheet-btn-fill: #1c2530;
  --sheet-actions-shadow: rgba(0, 0, 0, 0.45);
  /* Aliasy dla istniejących selektorów */
  --bg: var(--sheet-bg);
  --card: var(--sheet-surface);
  --text: var(--sheet-text);
  --muted: var(--sheet-muted);
  --accent: var(--sheet-accent);
  --danger: var(--sheet-danger);
  --border: var(--sheet-line);
  font-family: var(--sheet-font-ui);
}

@media (prefers-color-scheme: light) {
  :root {
    --sheet-bg: #ebe6de;
    --sheet-surface: #faf7f1;
    --sheet-line: #c4bdb0;
    --sheet-text: #1a1814;
    --sheet-muted: #5c574c;
    --sheet-accent: #1d5a8a;
    --sheet-danger: #a83232;
    --sheet-focus: #0b5cad;
    --sheet-row-alt: rgba(0, 0, 0, 0.035);
    --sheet-btn-fill: #f2efe8;
    --sheet-actions-shadow: rgba(0, 0, 0, 0.12);
    --bg: var(--sheet-bg);
    --card: var(--sheet-surface);
    --text: var(--sheet-text);
    --muted: var(--sheet-muted);
    --accent: var(--sheet-accent);
    --danger: var(--sheet-danger);
    --border: var(--sheet-line);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--sheet-bg);
  color: var(--sheet-text);
  line-height: 1.45;
  font-family: var(--sheet-font-ui);
}

.top {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  max-width: var(--layout-max);
  margin: 0 auto;
}

.top h1 { margin: 0 0 0.35rem; font-size: 1.35rem; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.sheet {
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: 1rem 1.5rem 3.65rem;
}

.sheet-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

.sheet-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

@media (min-width: 1100px) {
  .sheet-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    align-items: start;
  }

  .sheet-section--profession,
  .sheet-section--identity,
  .sheet-section--equipment {
    grid-column: 1 / -1;
  }

  .sheet-column--left {
    grid-column: 1;
  }

  .sheet-column--right {
    grid-column: 2;
  }
}

.sheet-section {
  background: var(--sheet-surface);
  border: 1px solid var(--sheet-line);
  border-radius: var(--sheet-radius-section);
  padding: 0.85rem 1rem;
}

.sheet-section h2 {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--sheet-line);
  padding-bottom: 0.35rem;
}

.sheet-section h3.equip-sub {
  margin: 0.65rem 0 0.25rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--sheet-text);
}

.sheet-section .stats-tools-title {
  margin: 0.65rem 0 0.25rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--sheet-text);
  border-bottom: none;
  padding-bottom: 0;
}

.stats-tools-hint {
  margin: 0 0 0.4rem;
}

.sheet-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  align-items: flex-end;
  margin: 0.35rem 0 0.6rem;
}

.sheet-toolbar--inline {
  margin: 0;
}

.sheet-toolbar .toolbar-field {
  display: block;
  margin-bottom: 0;
  flex: 1;
  min-width: 12rem;
  font-size: 0.9rem;
}

/* .toolbar-field wymusza display:block — bez tego atrybut [hidden] nie chowa drugiego selecta presetów */
.sheet-toolbar label.toolbar-field[hidden],
#equipmentPresetChoiceWrap[hidden],
#professionPick[hidden],
#professionHint[hidden] {
  display: none !important;
}

.sheet-toolbar.equip-lib {
  margin-bottom: 0.5rem;
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  position: sticky;
  bottom: 0;
  z-index: 4;
  margin-top: 1rem;
  padding-top: 0.75rem;
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  background: var(--sheet-surface);
  border-top: 1px solid var(--sheet-line);
  box-shadow: 0 -8px 24px var(--sheet-actions-shadow);
}

.sheet-actions #status {
  margin-left: auto;
  flex: 1 1 12rem;
  text-align: right;
}

.sheet-actions .save-slot-label {
  display: flex;
  align-items: center;
  flex: 999 1 24rem;
  min-width: 18rem;
  gap: 0.4rem;
  margin: 0;
  white-space: nowrap;
}

.sheet-actions .save-slot-label select {
  flex: 1 1 24rem;
  min-width: 16rem;
  margin: 0;
}

@media (max-width: 640px) {
  .sheet-actions .save-slot-label {
    flex: 1 1 100%;
  }

  .sheet-actions #status {
    margin-left: 0;
    flex: 1 1 100%;
    text-align: left;
  }
}

a { color: var(--accent); }

label { display: block; margin-bottom: 0.6rem; font-size: 0.9rem; }
label.inline { margin-top: 0.75rem; }

input[type="text"],
input[type="number"],
input[type="date"] {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.45rem 0.5rem;
  border-radius: var(--sheet-radius-control);
  border: 1px solid var(--sheet-line);
  background: var(--sheet-bg);
  color: var(--sheet-text);
  font: inherit;
}

textarea {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.45rem 0.5rem;
  border-radius: var(--sheet-radius-control);
  border: 1px solid var(--sheet-line);
  background: var(--sheet-bg);
  color: var(--sheet-text);
  font: inherit;
  line-height: 1.5;
  resize: vertical;
}

label.block textarea,
.sheet-section > textarea {
  padding: 0.55rem 0.65rem;
  min-height: 9rem;
}

.sheet-section--notes > textarea {
  min-height: 6.75rem;
}

.adaptation-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 2rem;
  align-items: center;
  margin: 0 0 0.65rem;
  font-size: 0.9rem;
}

.adaptation-row {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.adaptation-label {
  font-weight: 500;
}

.adaptation-box {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.adaptation-box input {
  width: 0.95rem;
  height: 0.95rem;
  margin: 0;
}

.adaptation-box.is-disabled {
  opacity: 0.55;
}

.adaptation-note {
  display: inline-block;
  font-size: 0.82rem;
  font-style: italic;
  min-width: 5.1em;
}

.adaptation-note.is-complete {
  font-weight: 700;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem 0.75rem;
}

.stats-pl label,
.stats-pl label.stat-block {
  display: flex;
  flex-direction: column;
}

.stat-note-wrap {
  margin-top: 0.3rem;
}

.stat-note-wrap[hidden] {
  display: none !important;
}

input.stat-note {
  font-size: 0.82rem;
  padding: 0.35rem 0.45rem;
}

.stat-x5 {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.derived-pl dt {
  font-size: 0.7rem;
  line-height: 1.25;
}

.has-formula-tip {
  cursor: help;
  text-decoration: underline dotted;
  text-decoration-color: var(--muted);
  text-underline-offset: 2px;
}

@media (max-width: 520px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}

.derived {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0;
}

.derived > div {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.45rem;
}

.derived dt {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.2;
  color: var(--muted);
}
.derived dd {
  margin: 0.12rem 0 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.derived-value-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}

.derived-value-row .icon-button {
  min-width: 1.72rem;
  padding: 0.26rem 0.38rem;
  font-size: 0.95rem;
}

.derived dd input[type="number"] {
  width: 100%;
  margin: 0;
  margin-top: 0.1rem;
  padding: 0.3rem 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
}

@media (max-width: 900px) {
  .derived { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .derived { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.row-between h2 { margin: 0; }

.sheet-section .row-between h2 {
  margin: 0 0 0.65rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--sheet-line);
  letter-spacing: 0.02em;
  font-size: 0.95rem;
  flex: 1 1 auto;
  min-width: 0;
}

.sheet-section .row-between {
  margin-bottom: 0.65rem;
}

h3.equip-sub {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.equip-gap {
  margin-top: 1rem;
}

button {
  font: inherit;
  font-family: var(--sheet-font-ui);
  cursor: pointer;
  border-radius: var(--sheet-radius-control);
  border: 1px solid var(--sheet-line);
  background: var(--sheet-btn-fill);
  color: var(--sheet-text);
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  transition: border-color 0.12s ease, background 0.12s ease;
}

button:hover {
  border-color: var(--sheet-accent);
}

button:focus-visible {
  outline: 2px solid var(--sheet-focus);
  outline-offset: 2px;
}

button.danger {
  border-color: var(--sheet-danger);
  color: var(--sheet-danger);
  background: transparent;
}

button.secondary {
  font-size: 0.8rem;
  padding: 0.32rem 0.55rem;
  background: transparent;
}

button.icon-button {
  line-height: 1;
  min-width: 1.6rem;
  padding: 0.2rem 0.3rem;
}

.help-modal {
  width: min(92vw, 42rem);
  max-height: min(82vh, 40rem);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--sheet-line);
  border-radius: var(--sheet-radius-section);
  background: var(--sheet-surface);
  color: var(--sheet-text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.help-modal::backdrop {
  background: rgba(0, 0, 0, 0.58);
}

.help-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--sheet-line);
}

.help-modal__header h2 {
  margin: 0;
  font-size: 1rem;
}

.help-modal__content {
  max-height: calc(min(82vh, 40rem) - 3.25rem);
  overflow: auto;
  padding: 0.9rem;
  white-space: pre-wrap;
  line-height: 1.55;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.data th,
table.data td {
  border-bottom: 1px solid var(--border);
  padding: 0.35rem 0.25rem;
  text-align: left;
}

table.data input {
  width: 100%;
  margin: 0;
}

/* Wyposażenie: zawijanie długich nazw/notatek; na wąskim ekranie ~2 widoczne linie, na szerszym ~3 */
table.data textarea.equip-cell-2ln {
  display: block;
  width: 100%;
  margin: 0;
  --equip-2ln-pad-y: 0.35rem;
  padding: var(--equip-2ln-pad-y) 0.4rem;
  border-radius: var(--sheet-radius-control);
  border: 1px solid var(--sheet-line);
  background: var(--sheet-bg);
  color: var(--sheet-text);
  font: inherit;
  line-height: 1.35;
  resize: none;
  overflow-y: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
  min-height: calc(2 * 1.35em + 2 * var(--equip-2ln-pad-y));
  max-height: calc(2 * 1.35em + 2 * var(--equip-2ln-pad-y));
}

@media (min-width: 1100px) {
  table.data textarea.equip-cell-2ln {
    min-height: calc(3 * 1.35em + 2 * var(--equip-2ln-pad-y));
    max-height: calc(3 * 1.35em + 2 * var(--equip-2ln-pad-y));
  }
}

table.data.dense tbody td {
  vertical-align: top;
}

table.data .equip-expense-readonly {
  display: block;
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.35;
  padding: 0.35rem 0.4rem;
  border-radius: 6px;
  border: 1px dashed var(--border);
  background: var(--bg);
  color: var(--text);
}

table.data .equipment-empty-row .equipment-empty-control {
  min-height: calc(2 * 1.35em + 0.7rem);
  border-style: dashed;
  opacity: 0.85;
  pointer-events: none;
}

table.data .equipment-empty-row textarea.equipment-empty-control,
table.data .equipment-empty-row input.equipment-empty-control {
  background: var(--sheet-bg);
  color: transparent;
}

table.data select {
  width: 100%;
  margin: 0;
  font: inherit;
  padding: 0.35rem 0.4rem;
  border-radius: var(--sheet-radius-control);
  border: 1px solid var(--sheet-line);
  background: var(--sheet-bg);
  color: var(--sheet-text);
}

#weaponsTable th.weapon-skill-heading {
  min-width: 10rem;
  width: 12%;
}

/* Pierwsza kolumna (nazwa) — broń ma minimalnie więcej miejsca na długie nazwy. */
#weaponsTable th:first-child,
#weaponsTable td:first-child {
  width: 20%;
  max-width: 17rem;
}

/* Pierwsza kolumna (nazwa) — pancerz i inny sprzęt */
#armorTable th:first-child,
#armorTable td:first-child,
#otherGearTable th:first-child,
#otherGearTable td:first-child {
  width: 20%;
  max-width: 17rem;
}

#otherGearTable th:first-child,
#otherGearTable td:first-child {
  width: 22%;
  max-width: 19rem;
}

#armorTable,
#otherGearTable {
  table-layout: fixed;
}

/* Pancerz: kolumna wartości — wąska jak dotąd */
#armorTable th:nth-child(2),
#armorTable td:nth-child(2) {
  width: 5rem;
  white-space: nowrap;
}

/* Notatki — reszta szerokości tabeli */
#armorTable th:nth-child(3),
#armorTable td:nth-child(3),
#otherGearTable th:nth-child(2),
#otherGearTable td:nth-child(2) {
  width: auto;
}

#otherGearTable th:last-child,
#otherGearTable td:last-child {
  width: 3.4rem;
  text-align: center;
  white-space: nowrap;
}

#weaponsTable th:last-child,
#weaponsTable td:last-child {
  width: 3.4rem;
  text-align: center;
  white-space: nowrap;
}

#weaponsTable .weapon-skill-readonly {
  display: block;
  width: 100%;
  padding: 0.35rem 0.4rem;
  border-radius: var(--sheet-radius-control);
  border: 1px dashed var(--border);
  background: var(--bg);
  color: var(--text);
  min-height: calc(2 * 1.35em + 0.7rem);
  font: inherit;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
  text-wrap: wrap;
}

#weaponsTable .equip-weapon-skill-pick,
#weaponsTable .equip-weapon-stat-input,
#weaponsTable .equip-expense-input,
#armorTable .equip-expense-input,
#otherGearTable .equip-expense-input {
  box-sizing: border-box;
  width: 100%;
  font: inherit;
  color: var(--sheet-text);
  background: var(--sheet-bg);
  border: 1px solid var(--sheet-line);
  border-radius: var(--sheet-radius-control);
  padding: 0.35rem 0.4rem;
}

#weaponsTable .equip-weapon-skill-pick {
  min-height: calc(2 * 1.35em + 0.7rem);
}

#weaponsTable tr[data-weapon-editable="1"] .equip-weapon-stat-cell:not(.weapon-pct-cell) {
  white-space: normal;
  width: auto;
  min-width: 3.5rem;
}

/* Kolumna % — między „od treści” (~3rem) a poprzednim 6rem; kręć --weapon-pct-col */
#weaponsTable th.weapon-pct-heading,
#weaponsTable .weapon-pct-cell {
  width: var(--weapon-pct-col);
  white-space: nowrap;
}

/* Kat. wyd. — krótkie etykiety (Zwykłe, Niecodzienne…); ta sama szerokość wszędzie */
#weaponsTable th:nth-child(9),
#weaponsTable .equip-expense-cell,
#armorTable th:nth-child(4),
#armorTable .equip-expense-cell,
#otherGearTable th:nth-child(3),
#otherGearTable .equip-expense-cell {
  width: var(--weapon-expense-col);
  max-width: var(--weapon-expense-col);
  box-sizing: border-box;
}

#weaponsTable .equip-expense-cell .equip-expense-readonly,
#armorTable .equip-expense-cell .equip-expense-readonly,
#otherGearTable .equip-expense-cell .equip-expense-readonly,
#armorTable .equip-expense-cell .equip-expense-input,
#otherGearTable .equip-expense-cell .equip-expense-input {
  padding-inline: 0.25rem;
  font-size: 0.78rem;
  text-align: center;
  overflow-wrap: anywhere;
}

/* Pozostałe krótkie staty — lekko poszerzone po zmniejszeniu nazwy broni */
#weaponsTable .equip-weapon-stat-cell:not(.weapon-pct-cell) {
  width: 2%;
  white-space: nowrap;
}

#weaponsTable th:nth-child(5),
#weaponsTable td:nth-child(5),
#weaponsTable th:nth-child(6),
#weaponsTable td:nth-child(6),
#weaponsTable th:nth-child(7),
#weaponsTable td:nth-child(7) {
  width: 3%;
}

#weaponsTable th:nth-child(6),
#weaponsTable td:nth-child(6) {
  min-width: 4.5rem;
}

#weaponsTable .equip-weapon-stat-cell .equip-expense-readonly {
  text-align: center;
}

#weaponsTable .weapon-pct-cell .weapon-pct {
  box-sizing: border-box;
  width: 100%;
  text-align: center;
}

#weaponsTable .weapon-pct {
  font-family: var(--sheet-font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.site-footer {
  padding: 0.65rem 1.5rem 2rem;
  max-width: var(--layout-max);
  margin: 0 auto;
}

.site-footer__legal {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.5;
  max-width: 52rem;
  opacity: 0.92;
}

.stat-roll-pool-wrap {
  margin: 0.35rem 0 0.65rem;
  line-height: 1.55;
}

.stat-roll-pool-label {
  margin-right: 0.2rem;
}

.stat-roll-pool-inner {
  display: inline;
}

.stat-roll-parens {
  font-weight: 400;
  color: var(--muted);
}

.stat-roll-val {
  font-weight: 700;
  cursor: help;
}

.stat-roll-val.is-used {
  font-weight: 400;
  text-decoration: line-through;
  opacity: 0.72;
}

.stat-roll-pool-hint {
  font-size: 0.85rem;
}

.stat-roll-pool-trend {
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 0.35rem;
  vertical-align: 0.08em;
  border-left: 0.34rem solid transparent;
  border-right: 0.34rem solid transparent;
}

.stat-roll-pool-trend.is-high {
  border-bottom: 0.58rem solid #2ea043;
}

.stat-roll-pool-trend.is-low {
  border-top: 0.58rem solid var(--danger);
}

label.inline.tight {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
}

.row-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
}

label.grow {
  flex: 1;
  min-width: 12rem;
}

label.tight {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  margin: 0;
}

.slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.5rem 0.75rem;
}

.slot {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.slot select {
  width: 100%;
  margin: 0;
}

.slot-spec-input {
  width: 100%;
  margin: 0;
  font-size: 0.82rem;
  padding: 0.28rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}

.pick-box {
  margin-top: 0.5rem;
  padding: 0.5rem 0.6rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.prof-readonly-skills {
  margin: 0.15rem 0 0;
  padding-left: 1.15rem;
  font-size: 0.86rem;
  line-height: 1.45;
}

.prof-fixed-skills-block .prof-fixed-skills-caption,
.prof-full-package-readonly > .muted {
  margin: 0 0 0.2rem;
}

.prof-fixed-skills-sep {
  border: none;
  border-top: 1px dashed rgba(128, 128, 128, 0.4);
  margin: 0.45rem 0 0.35rem;
  width: 100%;
}

.pick-line {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  font-size: 0.88rem;
  cursor: pointer;
}

.pick-line input {
  margin-top: 0.2rem;
}

/* Obowiązkowe pozycje bez checkboxa (np. języki) — jednolite kółko, nie myli z radiem Agenta */
.pick-line--marker {
  cursor: default;
  align-items: center;
}

.prof-pick-bullet {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border: 2px solid var(--muted);
  border-radius: 50%;
  flex-shrink: 0;
  box-sizing: border-box;
  margin-top: 0.12rem;
}

.pick-row--spec-marker .prof-spec-field {
  margin-left: 1.35rem;
}

.pick-row.prof-pick-locked .pick-line {
  opacity: 0.52;
  cursor: not-allowed;
}

.pick-row.prof-pick-locked .pick-line input {
  cursor: not-allowed;
}

.pick-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
  padding: 0.35rem 0;
}

.pick-row .pick-line {
  flex: none;
}

.pick-row--spec {
  padding-bottom: 0.45rem;
  margin-bottom: 0.12rem;
  border-bottom: 1px dashed rgba(128, 128, 128, 0.35);
}

.pick-row--spec:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.prof-spec-field {
  margin-left: 1.45rem;
}

.prof-spec-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.prof-spec-label .prof-pick-spec {
  flex: 1 1 12rem;
  min-width: min(100%, 11rem);
  max-width: 100%;
  box-sizing: border-box;
  font-size: 0.88rem;
  padding: 0.28rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}

.pick-row.prof-pick-locked .prof-spec-label .prof-pick-spec {
  opacity: 0.52;
}

.pick-group-divider {
  border: none;
  border-top: 1px dashed var(--border);
  margin: 0.6rem 0 0.5rem;
}

.pick-group-label {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.table-wrap {
  max-height: min(70vh, 36rem);
  overflow: auto;
  border: 1px solid var(--sheet-line);
  border-radius: var(--sheet-radius-section);
}

.skills-master-wrap {
  max-height: min(78vh, 44rem);
}

table.data thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--sheet-surface);
  box-shadow: 0 1px 0 var(--sheet-line);
}

table.data tbody tr:nth-child(even) td {
  background: var(--sheet-row-alt);
}

table.dense th,
table.dense td {
  padding: 0.28rem 0.35rem;
  font-size: 0.82rem;
}

.skill-name {
  white-space: nowrap;
}

#weaponsTable .weapon-pct.warn {
  color: #e66;
  font-weight: 600;
}

.cell-warn.warn {
  color: #e66;
  font-weight: 600;
  font-size: 0.78rem;
}

.error {
  color: #e66;
  font-size: 0.85rem;
}

.identity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.5rem 1rem;
  margin-bottom: 0.5rem;
}

@media (min-width: 1100px) {
  .identity-grid {
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  }
}

label.block {
  display: block;
  margin-top: 0.5rem;
}

@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }

  .top,
  .site-footer,
  .sheet-toolbar,
  .sheet-actions,
  #professionHint,
  #professionPick,
  #statPoolLine,
  #statRollPoolWrap,
  .row-del {
    display: none !important;
  }

  #bondsTable th:last-child,
  #bondsTable td:last-child,
  #weaponsTable th:last-child,
  #weaponsTable td:last-child,
  #armorTable th:last-child,
  #armorTable td:last-child,
  #otherGearTable th:last-child,
  #otherGearTable td:last-child {
    display: none !important;
  }

  .sheet {
    padding: 0.4rem 0.6rem 1rem;
    max-width: none;
  }

  .sheet-layout {
    display: block;
  }

  .sheet-section {
    break-inside: avoid;
    page-break-inside: avoid;
    border: 1px solid #999;
    border-radius: 0;
    background: #fff;
    color: #000;
    margin-bottom: 0.5rem;
    box-shadow: none;
  }

  .sheet-section h2 {
    border-color: #999;
    color: #000;
  }

  .muted,
  .small {
    color: #333 !important;
  }

  .table-wrap {
    max-height: none !important;
    overflow: visible !important;
    border: 1px solid #bbb;
  }

  table.data thead th {
    position: static;
    box-shadow: none;
    background: #e8e8e8 !important;
    color: #000 !important;
  }

  table.data tbody tr:nth-child(even) td {
    background: #f5f5f5;
  }

  input,
  textarea,
  select,
  button {
    border-color: #999 !important;
    color: #000 !important;
    background: #fff !important;
  }

  a[href]::after {
    content: "";
  }
}
