/* Approved character-sheet composition.
   This file owns the sheet layout; application chrome remains in styles.css. */

.character-sheet{
  --sheet-heading-fill:color-mix(in srgb,var(--ui-surface-muted) 72%,var(--ui-surface));
  --sheet-heading-rule:color-mix(in srgb,var(--ui-border-strong,var(--ui-border)) 35%,var(--ui-border));
  width:min(1180px,calc(100% - 28px));
  max-width:1180px;
  margin:14px auto 36px;
  padding:12px 13px 14px;
  color:var(--ui-text,var(--ink));
  background:var(--ui-paper,var(--paper));
  font-size:12px;
  line-height:1.28;
}

.character-sheet input,
.character-sheet select,
.character-sheet textarea,
.character-sheet button{
  min-width:0;
  font-size:12px;
}

.character-sheet .block,
.character-sheet .sheet-macro,
.character-sheet details{
  border-radius:0!important;
  box-shadow:none!important;
}

.character-sheet .block-title,
.character-sheet #journalDetails > summary{
  min-height:28px!important;
  padding:5px 30px 5px 8px!important;
  border-bottom:1px solid var(--sheet-heading-rule)!important;
  color:var(--ui-text)!important;
  background:var(--sheet-heading-fill)!important;
  font-size:11px!important;
  font-weight:800!important;
  letter-spacing:.045em!important;
  line-height:1.15!important;
  text-align:left!important;
  text-transform:uppercase;
}

.character-sheet .block-title::before{
  display:none!important;
}

.character-sheet .block-body{
  padding:7px 8px!important;
}

.character-sheet .visually-hidden-title{
  position:absolute!important;
  width:1px!important;
  height:1px!important;
  min-height:0!important;
  margin:-1px!important;
  padding:0!important;
  overflow:hidden!important;
  clip:rect(0 0 0 0)!important;
  border:0!important;
  white-space:nowrap!important;
}

#editorView.view-mode .character-sheet .edit-only-control,
#editorView.view-mode .character-sheet .add-row,
#editorView.view-mode .character-sheet .remove{
  display:none!important;
}

/* Identity strip */
.character-sheet .identity-bar{
  display:grid!important;
  grid-template-columns:1.85fr 1fr .95fr 3.05fr .45fr .5fr .5fr .28fr 1.1fr!important;
  grid-template-areas:none!important;
  gap:6px!important;
  align-items:end!important;
  margin:0 0 8px!important;
  padding:0!important;
  border:0!important;
  background:transparent!important;
}

.character-sheet .identity-bar > *{
  grid-area:auto!important;
  min-width:0;
}

.character-sheet .identity-bar .field{
  display:grid;
  gap:3px;
  align-content:end;
}

.character-sheet .identity-bar .field label,
.character-sheet .identity-unspent > span{
  overflow:hidden;
  color:var(--ui-secondary,var(--muted));
  font-size:9.5px;
  font-weight:750;
  letter-spacing:.035em;
  line-height:1.1;
  text-overflow:ellipsis;
  text-transform:uppercase;
  white-space:nowrap;
}

.character-sheet .identity-bar .field input{
  width:100%;
  height:29px!important;
  min-height:29px!important;
  padding:4px 6px!important;
  border:1px solid var(--ui-border)!important;
  border-radius:2px!important;
  background:var(--ui-field)!important;
  font-size:11.5px!important;
}

.character-sheet .identity-name input{
  font-size:13px!important;
  font-weight:750;
}

.character-sheet .identity-age input,
.character-sheet .identity-height input,
.character-sheet .identity-weight input,
.character-sheet .identity-sm input{
  padding-inline:3px!important;
  text-align:center;
}

.character-sheet .identity-points{
  position:relative;
  display:grid;
  grid-template-columns:42px minmax(0,1fr);
  gap:4px;
  align-items:end;
}

.character-sheet .identity-points > *{
  grid-area:auto!important;
}

.character-sheet .total-points{
  min-width:0;
  min-height:43px!important;
  border:1px solid var(--ui-border-strong,var(--ui-border))!important;
  background:var(--ui-accent-soft)!important;
}

.character-sheet .total-points > summary{
  min-height:41px!important;
  padding:3px 21px 3px 5px!important;
}

.character-sheet .total-points > summary::after{
  right:3px;
  width:16px;
  height:16px;
  border-radius:2px;
  font-size:12px;
  line-height:14px;
}

.character-sheet .total-points .tiny{
  font-size:9px;
  line-height:1;
}

.character-sheet .total-points strong{
  margin:0;
  font-size:19px!important;
}

.character-sheet .points-breakdown{
  right:0;
  width:250px;
  z-index:20;
}

.character-sheet .identity-unspent{
  display:grid;
  gap:3px;
  min-width:0;
}

.character-sheet .identity-bar .identity-unspent input{
  width:100%;
  height:29px!important;
  min-height:29px!important;
  padding:2px!important;
  border:1px solid var(--ui-border)!important;
  border-radius:2px!important;
  background:var(--ui-field)!important;
  font-size:14px!important;
  font-weight:800;
  text-align:center;
}

/* Shared macro boundaries and collapse */
.character-sheet .sheet-macro{
  position:relative;
  margin-top:8px!important;
  overflow:hidden;
  border:1px solid var(--ui-border-strong,var(--ui-border))!important;
  background:var(--ui-surface,var(--paper));
}

.character-sheet .macro-collapse-btn,
.character-sheet .sheet-macro > .block-title .collapse-btn,
.character-sheet .traits-macro .skills-card > .block-title .collapse-btn{
  top:4px!important;
  right:5px!important;
  transform:none!important;
  width:20px!important;
  height:20px!important;
  padding:0!important;
  border:1px solid var(--ui-border-strong,var(--ui-border))!important;
  border-radius:2px!important;
  color:var(--ui-accent)!important;
  background:var(--ui-surface,var(--paper))!important;
  font-size:14px!important;
  line-height:18px!important;
  z-index:8;
}

.character-sheet .physical-macro.collapsed,
.character-sheet .social-macro.collapsed,
.character-sheet .traits-macro.collapsed{
  display:block!important;
  min-height:29px!important;
  height:29px!important;
  padding:0!important;
  cursor:pointer;
}

.character-sheet .sheet-macro.collapsed::before{
  content:attr(data-collapse-label);
  display:block;
  padding:6px 32px 5px 9px;
  color:var(--ui-text);
  background:var(--sheet-heading-fill);
  font-size:11px;
  font-weight:800;
  letter-spacing:.05em;
  line-height:16px;
  text-transform:uppercase;
}

.character-sheet .sheet-macro.block.collapsed::before{
  display:none;
}

.character-sheet .physical-macro.collapsed > .dashboard-column,
.character-sheet .social-macro.collapsed > .social-cell,
.character-sheet .traits-macro.collapsed > .stack{
  display:none!important;
}

.character-sheet .sheet-macro.block.collapsed > .block-body{
  display:none!important;
}

/* Physical group: 430 | 190 | 240 | 294 within the 1154px content width. */
.character-sheet .physical-macro{
  display:grid!important;
  grid-template-columns:430fr 190fr 240fr 294fr!important;
  grid-template-areas:
    "stats encumbrance dr portrait"
    "stats defenses defenses portrait"!important;
  grid-template-rows:minmax(176px,auto) minmax(156px,auto)!important;
  gap:0!important;
  align-items:stretch!important;
}

.character-sheet .physical-macro > .dashboard-column,
.character-sheet .physical-macro > .dashboard-combat{
  display:contents!important;
}

.character-sheet .physical-macro .characteristics-card{
  grid-area:stats!important;
}

.character-sheet .physical-macro .dashboard-encumbrance{
  grid-area:encumbrance!important;
}

.character-sheet .physical-macro .armor-defense-card{
  grid-area:dr!important;
}

.character-sheet .physical-macro .active-defense-card{
  grid-area:defenses!important;
}

.character-sheet .physical-macro .portrait-card{
  grid-area:portrait!important;
}

.character-sheet .physical-macro .characteristics-card,
.character-sheet .physical-macro .dashboard-encumbrance,
.character-sheet .physical-macro .armor-defense-card,
.character-sheet .physical-macro .active-defense-card,
.character-sheet .physical-macro .portrait-card{
  width:auto!important;
  min-width:0!important;
  height:auto!important;
  min-height:0!important;
  margin:0!important;
  align-self:stretch!important;
  overflow:hidden;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
}

.character-sheet .physical-macro .characteristics-card,
.character-sheet .physical-macro .dashboard-encumbrance,
.character-sheet .physical-macro .armor-defense-card{
  border-right:1px solid var(--ui-border)!important;
}

.character-sheet .physical-macro .dashboard-encumbrance,
.character-sheet .physical-macro .armor-defense-card{
  border-bottom:1px solid var(--ui-border)!important;
}

.character-sheet .physical-macro .active-defense-card{
  border-right:1px solid var(--ui-border)!important;
}

/* Official-sheet attribute relationship */
.character-sheet .characteristics-card > .block-body{
  display:grid!important;
  grid-template-rows:minmax(0,1fr) auto auto auto;
  gap:6px;
  height:100%!important;
  align-content:start;
  padding:7px 9px!important;
}

.character-sheet .stat-pairs{
  display:grid!important;
  grid-template-rows:auto repeat(4,minmax(37px,1fr));
  gap:0!important;
}

.character-sheet .stat-column-head,
.character-sheet .stat-pair{
  display:grid!important;
  grid-template-columns:34px 66px 40px 46px 66px 66px 40px!important;
  gap:4px!important;
  align-items:center!important;
  justify-content:space-between;
}

.character-sheet .stat-column-head{
  min-height:19px;
  color:var(--ui-secondary,var(--muted));
  font-size:10px;
  font-weight:750;
  line-height:1.15;
  text-align:center;
  text-transform:uppercase;
}

.character-sheet .stat-pair{
  min-height:37px!important;
  padding:2px 0;
  border-bottom:1px solid color-mix(in srgb,var(--ui-border) 62%,transparent);
}

.character-sheet .stat-label{
  font-family:var(--font-heading);
  font-size:22px!important;
  font-weight:800!important;
  line-height:1!important;
  text-align:left;
}

.character-sheet .stat-value,
.character-sheet .stat-current{
  width:100%!important;
  height:31px!important;
  min-height:31px!important;
  padding:2px 4px!important;
  border:1px solid var(--ui-border-strong,var(--ui-border))!important;
  border-radius:1px!important;
  background:var(--ui-field)!important;
  font-size:17px!important;
  font-weight:800!important;
  text-align:center;
}

.character-sheet .stat-current-wrap::before{
  display:none!important;
}

.character-sheet .stat-current-spacer{
  height:31px!important;
}

.character-sheet .stat-cost,
.character-sheet .derived-cost{
  font-size:9.5px!important;
  text-align:center;
}

.character-sheet .derived-row{
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:5px!important;
  margin-top:0!important;
  padding-top:0!important;
  border:0!important;
}

.character-sheet .derived{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) 31px!important;
  gap:3px!important;
  min-height:42px!important;
  padding:3px 4px;
  border:1px solid var(--ui-border);
  background:color-mix(in srgb,var(--ui-surface) 86%,var(--ui-field));
}

.character-sheet .derived .tiny{
  grid-column:1 / -1;
  font-size:9.5px;
}

.character-sheet .derived-input{
  width:100%!important;
  height:24px!important;
  min-height:24px!important;
  padding:2px!important;
  border:0!important;
  border-bottom:1px solid var(--ui-border)!important;
  border-radius:0!important;
  background:transparent!important;
  font-size:12px!important;
}

#editorView.view-mode .character-sheet .derived-input{
  border-bottom-color:transparent!important;
}

.character-sheet .damage{
  display:grid!important;
  grid-template-columns:1fr 1fr!important;
  gap:7px!important;
  margin-top:0!important;
}

.character-sheet .damage .field{
  grid-template-columns:34px 1fr!important;
  gap:4px;
}

.character-sheet .damage input{
  height:25px!important;
  min-height:25px!important;
  border:0!important;
  border-bottom:1px solid var(--ui-border)!important;
  border-radius:0!important;
  background:transparent!important;
}

@media(min-width:1101px), print{
  .character-sheet .characteristics-card > .block-body{
    grid-template-rows:auto auto auto auto!important;
    gap:5px!important;
  }

  .character-sheet .characteristics-card .stat-pairs{
    grid-template-rows:19px repeat(4,52px)!important;
  }

  .character-sheet .characteristics-card .stat-column-head,
  .character-sheet .characteristics-card .stat-pair{
    grid-template-columns:40px 70px 42px 50px 70px 64px 42px!important;
    gap:0!important;
    justify-content:center!important;
  }

  .character-sheet .characteristics-card .stat-pair{
    height:52px!important;
    min-height:52px!important;
    padding:0!important;
    border-bottom:0!important;
  }

  .character-sheet .characteristics-card .stat-pair > *{
    min-width:0!important;
  }

  .character-sheet .characteristics-card .stat-label{
    padding:0!important;
    font-size:23px!important;
    text-align:right!important;
  }

  .character-sheet .characteristics-card .stat-value{
    width:calc(100% - 6px)!important;
    margin-left:6px!important;
  }

  .character-sheet .characteristics-card .stat-column-head > span:nth-child(2),
  .character-sheet .characteristics-card .stat-column-head > span:nth-child(5){
    padding-left:6px;
  }

  .character-sheet .characteristics-card .stat-value,
  .character-sheet .characteristics-card .stat-current{
    height:52px!important;
    min-height:52px!important;
    padding:2px!important;
    border-radius:0!important;
    font-size:21px!important;
  }

  .character-sheet .characteristics-card .stat-pair + .stat-pair > .stat-value{
    border-top:0!important;
  }

  .character-sheet .characteristics-card .stat-current-wrap,
  .character-sheet .characteristics-card .stat-current-spacer{
    width:100%!important;
    min-width:0!important;
    height:52px!important;
  }

  .character-sheet .characteristics-card .stat-current-wrap .stat-current{
    border-left:0!important;
  }

  .character-sheet .characteristics-card .stat-cost{
    padding-inline:4px;
  }

  .character-sheet .characteristics-card .derived-row{
    gap:0!important;
  }

  .character-sheet .characteristics-card .derived{
    min-height:43px!important;
    border-radius:0!important;
  }

  .character-sheet .characteristics-card .derived + .derived{
    border-left:0!important;
  }
}

.character-sheet .health-status-list{
  display:block;
  height:22px;
  min-height:22px;
  margin:0;
  overflow:hidden;
}

.character-sheet .health-status-reminder{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:4px;
  width:100%;
  height:22px;
  min-height:22px;
  padding:0;
  overflow:hidden;
}

.character-sheet .health-status-cell{
  display:flex;
  width:100%;
  height:22px;
  min-height:22px;
  padding:2px 5px;
  border-radius:2px;
  overflow:hidden;
  font-size:9.5px;
  line-height:1.15;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.character-sheet .health-status-reminder.is-empty,
.character-sheet .health-status-cell.is-empty{
  visibility:hidden;
}

#editorView .character-sheet #effectiveMove.is-health-penalized,
#editorView .character-sheet .active-defense-card .defense .defense-result.is-health-penalized,
#editorView.view-mode .character-sheet #effectiveMove.is-health-penalized,
#editorView.view-mode .character-sheet .active-defense-card .defense .defense-result.is-health-penalized{
  color:var(--status-hp)!important;
  -webkit-text-fill-color:var(--status-hp)!important;
}

/* Encumbrance and Move */
.character-sheet .dashboard-encumbrance > .block-body{
  display:grid!important;
  gap:5px!important;
  padding:6px!important;
}

.character-sheet .dashboard-encumbrance .encumbrance-controls{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) 58px!important;
  gap:5px!important;
  margin:0!important;
}

.character-sheet .encumbrance-field,
.character-sheet .effective-move-field{
  min-width:0;
}

.character-sheet .encumbrance-display,
.character-sheet .effective-move-display{
  display:grid;
  min-height:36px!important;
  place-items:center;
  padding:3px;
  border:1px solid var(--ui-border);
  background:var(--ui-field);
  text-align:center;
}

.character-sheet .effective-move-display strong{
  font-size:22px;
  line-height:1;
}

.character-sheet .encumbrance-display strong{
  font-size:12px!important;
}

.character-sheet .field-meta{
  font-size:9px;
}

.character-sheet .enc-table{
  width:100%;
  border-collapse:collapse;
}

.character-sheet .enc-table th,
.character-sheet .enc-table td{
  padding:3px 4px!important;
  border-bottom:1px solid color-mix(in srgb,var(--ui-border) 65%,transparent);
  font-size:10px!important;
  line-height:1.15;
}

.character-sheet .enc-table th:last-child,
.character-sheet .enc-table td:last-child{
  text-align:right;
}

.character-sheet .enc-table tr:last-child td{
  border-bottom:0!important;
}

.character-sheet .enc-table .current-load-row{
  outline:1px solid var(--ui-accent);
  outline-offset:-1px;
  background:var(--ui-accent-soft)!important;
  font-weight:800;
}

@media(min-width:1101px), print{
  .character-sheet .physical-macro{
    grid-template-rows:minmax(205px,auto) minmax(132px,auto)!important;
  }

  .character-sheet .dashboard-encumbrance{
    display:flex!important;
    flex-direction:column!important;
  }

  .character-sheet .dashboard-encumbrance > .block-body{
    grid-template-rows:minmax(84px,auto) minmax(0,1fr)!important;
    gap:4px!important;
    flex:1 1 auto!important;
    height:auto!important;
    min-height:0!important;
    padding:5px 6px 0!important;
  }

  .character-sheet .dashboard-encumbrance .encumbrance-controls{
    grid-template-columns:minmax(0,1fr) 73px!important;
    gap:6px!important;
    min-height:84px!important;
  }

  .character-sheet .dashboard-encumbrance .encumbrance-field{
    display:grid!important;
    grid-template-rows:minmax(17px,auto) minmax(0,1fr)!important;
  }

  .character-sheet .dashboard-encumbrance .encumbrance-field > label{
    align-self:center;
    color:var(--ui-secondary,var(--muted));
    font-size:9px!important;
    font-weight:750;
    line-height:1;
    text-transform:uppercase;
  }

  .character-sheet .dashboard-encumbrance .encumbrance-display{
    display:grid!important;
    grid-template-rows:minmax(25px,auto) minmax(15px,auto) minmax(24px,auto)!important;
    min-height:0!important;
    padding:0!important;
    border:0!important;
    background:transparent!important;
    place-items:stretch!important;
    text-align:left!important;
  }

  .character-sheet .dashboard-encumbrance #currentCarriedWeight{
    align-self:start;
    padding-bottom:3px;
    border-bottom:1px solid var(--ui-border);
    font-family:var(--font-value);
    font-size:17px!important;
    line-height:1.15!important;
  }

  .character-sheet .dashboard-encumbrance .encumbrance-level-label{
    align-self:end;
    min-height:13px;
    padding-top:1px;
    color:var(--ui-secondary,var(--muted));
    font-size:10px!important;
    font-weight:750;
    line-height:1.1;
    text-transform:uppercase;
  }

  .character-sheet .dashboard-encumbrance #currentEncumbrance{
    align-self:center;
    min-height:20px;
    padding-top:1px;
    font-family:var(--font-value);
    font-size:14px!important;
    line-height:1.3!important;
    text-align:left;
  }

  .character-sheet .dashboard-encumbrance .effective-move-field{
    display:grid!important;
    grid-template-rows:minmax(22px,auto) minmax(0,1fr)!important;
    min-height:84px!important;
    overflow:hidden;
    border:1px solid var(--ui-border);
    border-radius:4px;
    background:color-mix(in srgb,var(--ui-surface) 88%,var(--ui-field));
  }

  .character-sheet .dashboard-encumbrance .effective-move-field > label{
    display:grid;
    place-items:center;
    border-bottom:1px solid var(--ui-border);
    color:var(--ui-secondary,var(--muted));
    font-size:9px!important;
    font-weight:750;
    line-height:1;
    text-transform:uppercase;
  }

  .character-sheet .dashboard-encumbrance .effective-move-display{
    display:flex!important;
    min-height:0!important;
    padding:4px 3px!important;
    flex-direction:column;
    justify-content:center;
    border:0!important;
    background:transparent!important;
  }

  .character-sheet .dashboard-encumbrance .effective-move-display strong{
    min-height:31px;
    padding-top:1px;
    font-size:24px!important;
    line-height:1.2!important;
  }

  .character-sheet .dashboard-encumbrance #effectiveMoveMeta{
    margin-top:3px;
    font-size:9.5px!important;
    line-height:1.2!important;
    text-align:center;
    white-space:normal;
  }

  .character-sheet .dashboard-encumbrance .enc-table{
    height:auto!important;
    min-height:0;
    align-self:stretch;
    table-layout:fixed;
  }

  .character-sheet .dashboard-encumbrance .enc-table td{
    height:auto!important;
    padding:2px 1px!important;
    font-size:10px!important;
    line-height:1!important;
  }

  .character-sheet .dashboard-encumbrance .enc-table td:first-child{
    text-align:left;
  }

  .character-sheet .dashboard-encumbrance .enc-table td:last-child{
    font-weight:650;
  }

  .character-sheet .dashboard-encumbrance .enc-table .current-load-row{
    outline:0!important;
    box-shadow:inset 0 1px var(--ui-accent),inset 0 -1px var(--ui-accent);
  }
}

/* DR: compact 2 x 3 zones */
.character-sheet .armor-defense-card{
  display:flex!important;
  flex-direction:column!important;
}

.character-sheet .armor-defense-card > .block-body{
  display:flex!important;
  flex:1 1 auto!important;
  height:auto!important;
  padding:6px!important;
}

.character-sheet .armor-defense-card .dr-grid{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  grid-template-rows:repeat(3,minmax(0,1fr))!important;
  gap:5px!important;
  width:100%;
  height:100%!important;
}

.character-sheet .armor-defense-card .dr-row{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) 38px!important;
  grid-template-rows:auto minmax(16px,auto)!important;
  gap:2px 4px!important;
  min-height:0!important;
  padding:3px 4px!important;
  align-content:center!important;
  border:1px solid color-mix(in srgb,var(--ui-border) 72%,transparent);
  border-radius:0!important;
  background:transparent!important;
}

.character-sheet .dr-location{
  font-size:10px!important;
  font-weight:750;
}

.character-sheet .dr-value{
  width:38px!important;
  height:24px!important;
  min-height:24px!important;
  padding:2px!important;
  border:1px solid var(--ui-border)!important;
  border-radius:1px!important;
  background:var(--ui-field)!important;
  font-size:13px!important;
  font-weight:800;
  text-align:center;
}

.character-sheet .dr-source{
  grid-column:1 / -1;
  min-height:18px!important;
  max-height:32px!important;
  overflow:hidden;
  font-size:10px!important;
  line-height:1.2!important;
  text-overflow:ellipsis;
  white-space:normal!important;
}

@media(min-width:1101px), print{
  .character-sheet .armor-defense-card > .block-body{
    padding:0!important;
  }

  .character-sheet .armor-defense-card .dr-grid{
    gap:0!important;
    align-items:stretch!important;
  }

  .character-sheet .armor-defense-card .dr-row{
    grid-template-columns:minmax(0,1fr) 40px!important;
    grid-template-rows:24px minmax(0,1fr)!important;
    gap:0 4px!important;
    padding:4px 6px 3px!important;
    align-content:stretch!important;
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
  }

  .character-sheet .armor-defense-card .dr-row:nth-child(odd){
    border-right:1px solid var(--ui-border)!important;
  }

  .character-sheet .armor-defense-card .dr-row:nth-child(-n+4){
    border-bottom:1px solid var(--ui-border)!important;
  }

  .character-sheet .armor-defense-card .dr-location{
    align-self:center;
    font-size:10.5px!important;
    line-height:1!important;
  }

  .character-sheet .armor-defense-card .dr-value,
  #editorView.view-mode .character-sheet .armor-defense-card .dr-value{
    width:40px!important;
    height:23px!important;
    min-height:23px!important;
    padding:1px 2px!important;
    border:0!important;
    border-bottom:1px solid var(--ui-border-strong,var(--ui-border))!important;
    border-radius:0!important;
    background:transparent!important;
    font-size:15px!important;
  }

  .character-sheet .armor-defense-card .dr-source{
    min-height:0!important;
    max-height:28px!important;
    margin:0!important;
    align-self:start;
    font-size:10px!important;
    line-height:1.2!important;
  }
}

/* Active defenses: three connected paper-sheet cells. */
.character-sheet .active-defense-card > .block-body{
  display:block!important;
  height:auto!important;
  padding:5px!important;
}

.character-sheet .active-defense-card .defense-grid{
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:0!important;
  height:auto!important;
  margin:0!important;
}

.character-sheet .active-defense-card .defense-column{
  display:grid!important;
  grid-template-rows:minmax(91px,1fr) minmax(28px,auto)!important;
  gap:2px!important;
  min-width:0;
  min-height:0!important;
}

.character-sheet .active-defense-card .defense{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) 22px!important;
  grid-template-rows:16px minmax(34px,1fr) 24px!important;
  grid-template-areas:none!important;
  gap:2px!important;
  min-height:91px!important;
  padding:4px 1px!important;
  align-items:stretch!important;
  border:1px solid var(--ui-border)!important;
  border-radius:0!important;
  background:transparent!important;
}

.character-sheet .active-defense-card .defense-column + .defense-column .defense{
  border-left:0!important;
}

.character-sheet .active-defense-card .defense-title{
  grid-column:1 / -1!important;
  grid-row:1!important;
  font-family:var(--font-heading);
  font-size:11px!important;
  font-weight:800!important;
  letter-spacing:.06em;
  text-align:center;
}

.character-sheet .active-defense-card .defense select{
  grid-column:1!important;
  grid-row:3!important;
  display:block!important;
  width:100%!important;
  min-width:0!important;
  height:24px!important;
  min-height:24px!important;
  padding:2px!important;
  border:1px solid var(--ui-border)!important;
  border-radius:1px!important;
  background:var(--ui-field)!important;
  font-size:9.5px!important;
}

.character-sheet .active-defense-card .defense-result{
  grid-column:1 / -1!important;
  grid-row:2!important;
  display:flex!important;
  width:100%!important;
  height:100%!important;
  min-height:34px!important;
  margin:0!important;
  padding:0!important;
  align-items:center!important;
  justify-content:center!important;
  border:0!important;
  border-radius:0!important;
  color:var(--ui-text)!important;
  background:transparent!important;
  box-shadow:none!important;
  font-family:var(--font-value)!important;
  font-size:21px!important;
  font-weight:850!important;
  line-height:1!important;
  text-align:center!important;
}

.character-sheet .active-defense-card .defense-roll-input.is-manual{
  border-bottom:1px solid var(--ui-accent)!important;
}

.character-sheet .active-defense-card .defense-source-static{
  grid-column:1!important;
  grid-row:3!important;
  display:flex;
  min-height:24px;
  padding:2px 5px;
  align-items:center;
  border:1px solid var(--ui-border);
  color:var(--ui-secondary,var(--muted));
  background:var(--ui-field);
  font-size:10px;
}

.character-sheet .active-defense-card .defense-bonus-input{
  grid-column:2!important;
  grid-row:3!important;
  display:block!important;
  width:22px!important;
  min-width:22px!important;
  height:24px!important;
  min-height:24px!important;
  margin:0!important;
  padding:1px!important;
  border:1px solid var(--ui-border)!important;
  border-radius:1px!important;
  background:var(--ui-field)!important;
  font-size:9.5px!important;
  text-align:center!important;
}

.character-sheet .active-defense-card .defense-breakdown{
  display:block!important;
  height:auto;
  min-height:28px!important;
  margin:0!important;
  padding:2px 3px 0;
  overflow:visible;
  color:var(--ui-secondary,var(--muted));
  font-size:10px!important;
  line-height:1.15!important;
  text-align:center;
  text-overflow:clip;
  white-space:normal;
}

#editorView .character-sheet .active-defense-card .defense .defense-result,
#editorView.view-mode .character-sheet .active-defense-card .defense input.defense-result,
#editorView.view-mode .character-sheet .active-defense-card .defense strong.defense-result{
  border:0!important;
  color:var(--ui-text)!important;
  -webkit-text-fill-color:var(--ui-text)!important;
  background:transparent!important;
  box-shadow:none!important;
  opacity:1!important;
}

#editorView .character-sheet .active-defense-card .defense input.defense-result.is-manual,
#editorView.view-mode .character-sheet .active-defense-card .defense input.defense-result.is-manual{
  border-bottom:1px solid var(--ui-accent)!important;
}

#editorView.view-mode .character-sheet .active-defense-card .defense input.defense-bonus-input{
  border:1px solid var(--ui-border)!important;
  color:var(--ui-text)!important;
  -webkit-text-fill-color:var(--ui-text)!important;
  background:var(--ui-field)!important;
  box-shadow:none!important;
  opacity:1!important;
}

/* Vertical portrait without another visible heading or nested frame. */
.character-sheet .portrait-card > .block-body{
  display:block!important;
  height:100%!important;
  padding:7px!important;
}

.character-sheet .portrait-card .portrait{
  width:100%!important;
  height:332px!important;
  min-height:332px!important;
  max-height:332px!important;
  aspect-ratio:auto!important;
  border:1px solid var(--ui-border-strong,var(--ui-border))!important;
  border-radius:0!important;
}

.character-sheet .portrait-card .portrait img{
  width:100%!important;
  height:100%!important;
  object-fit:cover!important;
}

@media(min-width:1101px), print{
  .character-sheet .sheet-macro{
    overflow:visible!important;
  }

  .character-sheet .portrait-card > .block-body{
    height:100%!important;
    padding:6px!important;
  }

  .character-sheet .portrait-card .portrait{
    width:100%!important;
    height:100%!important;
    min-height:0!important;
    max-height:none!important;
    overflow:hidden;
    border:0!important;
  }

  .character-sheet :is(.sheet-macro > .macro-collapse-btn,#journalDetails > summary > .journal-collapse-tab){
    top:-1px!important;
    right:-16px!important;
    width:17px!important;
    height:29px!important;
    min-height:29px!important;
    border-left:0!important;
    border-radius:0!important;
    font-size:13px!important;
    line-height:27px!important;
    box-shadow:none;
  }

  .character-sheet .sheet-macro.collapsed > .macro-collapse-btn{
    top:-1px!important;
    height:29px!important;
    min-height:29px!important;
    line-height:27px!important;
  }
}

.character-sheet .portrait-placeholder{
  font-size:11px;
}

/* Social/cultural group */
.character-sheet .social-macro{
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:0!important;
  align-items:stretch;
}

.character-sheet .social-macro > .social-cell{
  min-width:0;
  margin:0!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
}

.character-sheet .social-macro .languages-card{
  grid-area:auto!important;
  width:auto!important;
  height:auto!important;
  align-self:stretch!important;
}

.character-sheet .social-macro .languages-card > .block-body{
  display:block!important;
  width:auto!important;
  height:auto!important;
  min-height:0!important;
}

.character-sheet .social-macro > .social-cell + .social-cell{
  border-left:1px solid var(--ui-border)!important;
}

.character-sheet .social-paper-fill{
  display:none;
}

@media(min-width:1101px), print{
  .character-sheet .social-macro > .social-cell{
    display:flex!important;
    flex-direction:column;
  }

  .character-sheet .social-macro > .social-cell > .block-body{
    display:flex!important;
    flex:1 1 auto;
    flex-direction:column;
    gap:0!important;
  }

  .character-sheet .social-paper-fill{
    display:block;
    flex:1 1 auto;
    min-height:0;
    background:repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 29px,
      color-mix(in srgb,var(--ui-border) 60%,transparent) 29px,
      color-mix(in srgb,var(--ui-border) 60%,transparent) 30px
    );
  }
}

.character-sheet .reaction-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) 52px 24px;
  gap:4px;
  align-items:center;
}

.character-sheet .reaction-row,
.character-sheet .cultural-row,
.character-sheet .language-row{
  min-height:29px!important;
  padding:2px 0;
  border-bottom:1px solid color-mix(in srgb,var(--ui-border) 60%,transparent);
}

.character-sheet .reaction-rows .reaction-row,
.character-sheet .language-rows .language-row,
.character-sheet .cultural-rows .cultural-row{
  border-radius:0!important;
  box-shadow:none!important;
}

.character-sheet .reaction-rows .reaction-row:nth-child(odd),
.character-sheet .language-rows .language-row:nth-child(odd),
.character-sheet .cultural-rows .cultural-row:nth-child(odd){
  background:var(--row-stripe-a)!important;
}

.character-sheet .reaction-rows .reaction-row:nth-child(even),
.character-sheet .language-rows .language-row:nth-child(even),
.character-sheet .cultural-rows .cultural-row:nth-child(even){
  background:var(--row-stripe-b)!important;
}

.character-sheet .reaction-row input,
.character-sheet .cultural-row input,
.character-sheet .language-row input,
.character-sheet .language-row select,
.character-sheet .culture-superhead input{
  width:100%;
  height:25px!important;
  min-height:25px!important;
  padding:2px 4px!important;
  border:1px solid var(--ui-border)!important;
  border-radius:1px!important;
  background:var(--ui-field)!important;
  font-size:10px!important;
}

.character-sheet .reaction-row input:last-of-type,
.character-sheet .cultural-row input[type="number"],
.character-sheet .culture-superhead input[type="number"]{
  text-align:center;
}

.character-sheet .reaction-rows,
.character-sheet .cultural-rows,
.character-sheet .language-rows{
  display:flex;
  flex-direction:column;
  gap:0!important;
}

.character-sheet .language-superhead,
.character-sheet .language-row{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) 84px 84px 38px 24px!important;
  gap:4px!important;
  align-items:center;
}

.character-sheet .language-superhead{
  padding-right:8px!important;
  color:var(--ui-secondary,var(--muted))!important;
  font-family:inherit!important;
  font-size:9px!important;
  text-align:center!important;
}

.character-sheet .language-superhead > span:first-child{
  color:var(--ui-text);
  font-size:11px;
  text-align:left;
}

.character-sheet .culture-superhead{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto 58px 44px;
  gap:4px;
  align-items:center;
  padding-right:8px!important;
  padding-block:3px!important;
}

.character-sheet .culture-superhead > span{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.character-sheet .culture-superhead > label{
  color:var(--ui-secondary,var(--muted));
  font-size:10.5px;
  font-weight:800;
  text-align:right;
}

.character-sheet .culture-superhead input{
  height:21px!important;
  min-height:21px!important;
  padding:1px 3px!important;
  font-weight:500!important;
  letter-spacing:0!important;
  text-align:center;
  text-transform:none;
}

.character-sheet .culture-superhead #techLevelInput{
  font-family:var(--font-value);
  font-size:14px!important;
  font-weight:800!important;
}

.character-sheet .culture-superhead input[data-key="techLevelPoints"]{
  font-size:11px!important;
}

.character-sheet .language-row label{
  min-width:0;
}

.character-sheet .language-name-wrap{
  position:relative;
  display:block;
}

.character-sheet .language-row-points{
  display:flex;
  width:38px;
  height:25px;
  align-items:center;
  justify-content:center;
  border:1px solid var(--ui-border);
  border-radius:1px;
  background:var(--ui-accent-soft);
  font-size:10px;
}

.character-sheet .remove{
  width:24px!important;
  min-width:24px!important;
  height:24px!important;
  min-height:24px!important;
  padding:0!important;
}

.character-sheet .language-actions{
  display:flex;
  gap:8px;
  min-height:29px;
  padding-top:4px;
  align-items:center;
  justify-content:space-between;
  color:var(--ui-secondary,var(--muted));
  font-size:10px;
}

.character-sheet .language-actions strong{
  color:var(--ui-text);
  font-size:12px;
}

.character-sheet .culture-card > .block-body{
  display:grid!important;
  gap:5px;
}

.character-sheet .cultural-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) 48px 24px;
  gap:4px;
  align-items:center;
}

@media(min-width:1101px), print{
  .character-sheet .reactions-card .social-paper-fill,
  .character-sheet .languages-card .social-paper-fill,
  .character-sheet .culture-card .social-paper-fill{
    --social-fill-first:var(--row-stripe-a);
    --social-fill-second:var(--row-stripe-b);
    background:repeating-linear-gradient(
      to bottom,
      var(--social-fill-first) 0,
      var(--social-fill-first) 29px,
      color-mix(in srgb,var(--ui-border) 60%,transparent) 29px,
      color-mix(in srgb,var(--ui-border) 60%,transparent) 30px,
      var(--social-fill-second) 30px,
      var(--social-fill-second) 59px,
      color-mix(in srgb,var(--ui-border) 60%,transparent) 59px,
      color-mix(in srgb,var(--ui-border) 60%,transparent) 60px
    );
  }

  .character-sheet .language-rows[data-next-stripe="b"] + .social-paper-fill,
  .character-sheet .cultural-rows[data-next-stripe="b"] + .social-paper-fill{
    --social-fill-first:var(--row-stripe-b);
    --social-fill-second:var(--row-stripe-a);
  }

  .character-sheet .reaction-rows:has(> .reaction-row:nth-child(odd):last-child) + .social-paper-fill{
    --social-fill-first:var(--row-stripe-b);
    --social-fill-second:var(--row-stripe-a);
  }

  .character-sheet .reaction-rows:has(> .reaction-row:nth-child(even):last-child) + .social-paper-fill{
    --social-fill-first:var(--row-stripe-a);
    --social-fill-second:var(--row-stripe-b);
  }

  /* Read/print hides empty reactions: stripe only the rows still on paper. */
  :is(#editorView.view-mode,html.print-mode) .character-sheet .reaction-rows > .reaction-row:nth-child(odd of :not(.view-empty-row)){
    background:var(--row-stripe-a)!important;
  }
  :is(#editorView.view-mode,html.print-mode) .character-sheet .reaction-rows > .reaction-row:nth-child(even of :not(.view-empty-row)){
    background:var(--row-stripe-b)!important;
  }
  :is(#editorView.view-mode,html.print-mode) .character-sheet .reaction-rows + .social-paper-fill{
    --social-fill-first:var(--row-stripe-a);
    --social-fill-second:var(--row-stripe-b);
  }
  :is(#editorView.view-mode,html.print-mode) .character-sheet .reaction-rows:has(> .reaction-row:nth-child(odd of :not(.view-empty-row)):nth-last-child(1 of :not(.view-empty-row))) + .social-paper-fill{
    --social-fill-first:var(--row-stripe-b);
    --social-fill-second:var(--row-stripe-a);
  }
}

.character-sheet .add-row.compact-add{
  width:auto;
  min-height:25px;
  margin-top:4px;
  padding:3px 7px;
  border-radius:2px;
  font-size:10px;
}

/* Full-width, row-oriented attacks */
.character-sheet :is(.hero-attacks,.traits-macro){
  --row-stripe-b:color-mix(in srgb,var(--ui-surface-soft) 84%,var(--ui-border));
}

.character-sheet .hero-attacks{
  width:100%;
}

.character-sheet .attacks-block-title{
  display:flex!important;
  gap:8px!important;
  align-items:center!important;
}

.character-sheet .attacks-bonus-control{
  display:flex!important;
  gap:5px;
  margin-left:auto;
  align-items:center;
  color:var(--ui-secondary,var(--muted));
  font-size:9.5px;
  letter-spacing:0;
  text-transform:none;
}

.character-sheet .attacks-bonus-control input{
  width:45px;
  height:23px;
  min-height:23px;
  padding:2px;
  text-align:center;
}

#editorView.view-mode .character-sheet .attacks-bonus-control input{
  border:1px solid var(--ui-border)!important;
  background:var(--ui-surface,var(--paper))!important;
  box-shadow:none!important;
}

.character-sheet .attacks-title-add{
  position:static!important;
  inset:auto!important;
  transform:none!important;
  min-height:23px!important;
  padding:3px 7px!important;
  border-radius:2px!important;
  font-size:9.5px!important;
}

.character-sheet .attacks-add-actions{
  display:flex;
  min-width:0;
  align-items:center;
  gap:3px;
  pointer-events:auto!important;
}

.character-sheet .attacks-add-actions .attacks-title-add{
  pointer-events:auto!important;
}

.character-sheet .hero-attacks .block-body{
  padding:0!important;
}

.character-sheet .hero-attacks .attack-list{
  display:flex!important;
  min-width:0;
  flex-direction:column;
  align-items:stretch!important;
  gap:0!important;
}

.character-sheet .attack-section{
  min-width:0;
}

.character-sheet .attack-section + .attack-section{
  border-top:1px solid var(--ui-border)!important;
}

.character-sheet .attack-section-title{
  min-height:23px;
  margin:5px 8px 0;
  padding:4px 5px 3px;
  color:var(--ui-text);
  background:transparent;
  font-family:var(--font-heading)!important;
  font-size:11px!important;
  font-weight:700;
  letter-spacing:.01em;
  line-height:1.25;
  text-transform:none;
}

.character-sheet .attack-table{
  min-width:0;
  margin-inline:8px;
}

.character-sheet .attack-table-melee{
  --attack-table-columns:minmax(260px,2.4fr) minmax(170px,1.45fr) minmax(105px,.9fr) minmax(90px,.72fr) minmax(90px,.72fr) minmax(62px,.52fr);
}

.character-sheet .attack-table-ranged{
  --attack-table-columns:minmax(220px,2.25fr) minmax(145px,1.45fr) minmax(100px,1fr) 60px minmax(90px,.9fr) 54px 66px 62px 54px 54px;
}

.character-sheet .attack-table .attack-table-row{
  display:grid!important;
  width:100%;
  min-width:0;
  box-sizing:border-box;
  grid-template-columns:var(--attack-table-columns)!important;
  column-gap:0!important;
  row-gap:0!important;
  align-items:stretch!important;
}

.character-sheet .attack-table .attack-table-cell,
.character-sheet .attack-table .attack-table-heading{
  box-sizing:border-box;
  border:0!important;
}

.character-sheet .attack-table-head{
  min-height:22px;
  border-bottom:1px solid var(--ui-border);
  background:color-mix(in srgb,var(--ui-paper,var(--paper)) 74%,var(--ui-surface-soft));
}

.character-sheet .attack-table-heading{
  display:flex;
  min-width:0;
  padding:3px 5px;
  align-items:center;
  justify-content:flex-start;
  overflow:hidden;
  color:var(--ui-secondary,var(--muted));
  font-family:var(--font-heading)!important;
  font-size:9.5px;
  font-weight:750;
  letter-spacing:.025em;
  line-height:1.15;
  text-align:left;
  text-overflow:ellipsis;
  text-transform:uppercase;
  white-space:nowrap;
}

.character-sheet .attack-table-heading:first-child{
  justify-content:flex-start;
  text-align:left;
}

.character-sheet .attack-table .attack-table-cell + .attack-table-cell,
.character-sheet .attack-table .attack-table-heading + .attack-table-heading{
  border-left:0!important;
}

.character-sheet .hero-attacks .attack-card,
.character-sheet .hero-attacks .custom-attack-unified > .custom-attack-summary{
  min-height:31px;
  margin:0!important;
  padding:0!important;
  border:0!important;
  border-radius:0!important;
  box-shadow:none!important;
}

.character-sheet .attack-card.attack-stripe-a{
  background:var(--row-stripe-a)!important;
}

.character-sheet .attack-card.attack-stripe-b{
  background:var(--row-stripe-b)!important;
}

.character-sheet .attack-card.attack-equipped,
.character-sheet .attack-card.attack-stowed,
.character-sheet .custom-attack-summary{
  color:var(--ui-text)!important;
  opacity:1!important;
  box-shadow:none!important;
}

.character-sheet .hero-attacks .attack-card-head{
  display:flex!important;
  grid-column:auto!important;
  min-width:0;
  min-height:30px!important;
  padding:3px 6px!important;
  flex-direction:row!important;
  align-items:center;
  justify-content:flex-start;
  gap:5px;
}

.character-sheet .attack-weapon-label{
  display:flex;
  min-width:0;
  align-items:baseline;
  gap:5px;
  overflow:hidden;
}

.character-sheet .attack-card-head strong,
.character-sheet .custom-attack-title-input{
  min-width:0;
  overflow:hidden;
  color:inherit;
  font-size:11px!important;
  font-weight:400!important;
  line-height:1.15!important;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.character-sheet .attack-mode{
  min-width:0;
  overflow:hidden;
  color:var(--ui-secondary,var(--muted));
  font-size:9.5px;
  line-height:1.15;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.character-sheet .attack-mode::before{
  content:"·";
  margin-right:5px;
}

.character-sheet .hero-attacks .attack-stat{
  display:flex!important;
  flex-direction:row!important;
  min-height:30px!important;
  padding:3px 5px!important;
  align-items:center;
  justify-content:flex-start;
  border-radius:0!important;
  background:transparent!important;
  text-align:left;
}

.character-sheet .attack-stat b{
  font-size:11px!important;
  font-weight:400!important;
  line-height:1.15;
  white-space:nowrap;
}

.character-sheet .attack-stat.attack-damage b{
  font-size:12px!important;
  font-weight:700!important;
  color:var(--ui-accent)!important;
}

.character-sheet .attack-stat.attack-skill strong{
  font-weight:700!important;
}

.character-sheet .attack-stat.attack-parry b{
  font-size:11px!important;
  color:var(--ui-text)!important;
}

.character-sheet .attack-table .custom-attack-unified{
  position:relative;
  width:100%;
  min-width:0;
  box-sizing:border-box;
  overflow:visible!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
}

.character-sheet .custom-attack-title-input{
  flex:1 1 auto;
  height:22px!important;
  min-height:22px!important;
  padding:1px 3px!important;
}

#editorView:not(.view-mode) .character-sheet .custom-attack-title-input{
  height:25px!important;
  min-height:25px!important;
  padding:1px 2px!important;
  border:1px solid var(--ui-border)!important;
  border-radius:0!important;
  background:var(--ui-field)!important;
  font-size:11px!important;
  font-weight:400!important;
  line-height:1.28!important;
  text-align:left;
}

#editorView:not(.view-mode) .character-sheet .custom-attack-title-input:focus{
  outline-offset:0;
}

#editorView.view-mode .character-sheet .custom-attack-title-input{
  text-align:left;
}

.character-sheet .hero-attacks .custom-attack-actions{
  position:static!important;
  display:flex;
  flex:0 0 auto;
  gap:2px;
}

.character-sheet .hero-attacks .custom-attack-actions button{
  width:20px!important;
  height:20px!important;
  min-height:20px!important;
  border-radius:2px!important;
  font-size:12px!important;
}

.character-sheet .attack-damage-bonus-toggle{
  display:inline-flex!important;
  min-height:0!important;
  margin-left:auto;
  flex:0 0 auto;
  align-items:center;
  gap:2px!important;
  color:var(--ui-secondary,var(--muted));
  font-size:8.5px!important;
  white-space:nowrap;
}

.character-sheet .attack-damage-bonus-toggle input{
  width:13px;
  height:13px;
  min-height:13px!important;
  margin:0;
}

.character-sheet .custom-attack-editor{
  padding:6px!important;
  border:0!important;
  border-radius:0!important;
  background:var(--ui-paper,var(--paper))!important;
  box-shadow:none!important;
}

/* Advantages/disadvantages + skills are one disclosure group. */
.character-sheet .traits-macro{
  display:grid!important;
  grid-template-columns:390fr 764fr!important;
  gap:0!important;
}

.character-sheet .traits-macro > .stack{
  min-width:0;
  gap:0!important;
}

.character-sheet .traits-column{
  border-right:1px solid var(--ui-border);
}

.character-sheet .traits-macro .block{
  min-width:0;
  margin:0!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
}

.character-sheet .traits-column .block + .block{
  border-top:1px solid var(--ui-border)!important;
}

.character-sheet .traits-macro .list-row,
.character-sheet .traits-macro .skill-row{
  border-bottom:0!important;
}

.character-sheet .traits-macro .trait-head,
.character-sheet .traits-paper-fill{
  display:none;
}

@media screen{
  #editorView:not(.view-mode) .character-sheet .traits-column .list-row > input{
    border-color:var(--ui-border)!important;
    background:var(--ui-field)!important;
  }
}

@media(min-width:1101px), print{
.character-sheet .traits-macro{
  grid-template-columns:520fr 634fr!important;
}

.character-sheet .traits-macro .block-title{
  font-size:11.5px!important;
}

.character-sheet .traits-macro .block-body{
  padding:4px 8px 5px!important;
}

.character-sheet .traits-macro .advantages-card .block-body{
  padding-bottom:0!important;
}

.character-sheet .traits-macro .disadvantages-card .block-title{
  min-height:33px!important;
}

.character-sheet .traits-macro .list-row,
.character-sheet .traits-macro .skill-row{
  height:30px;
  min-height:30px;
  padding:2px 3px!important;
  border-radius:0!important;
  box-shadow:none!important;
}

.character-sheet .traits-macro .list,
.character-sheet .traits-macro .skill-list{
  gap:0!important;
}

.character-sheet .traits-macro .skill-head,
.character-sheet .traits-macro .skill-row{
  grid-template-columns:minmax(140px,1fr) 60px 54px 24px 36px 24px 44px 48px 42px 24px!important;
  gap:3px!important;
}

.character-sheet .traits-macro .skill-head{
  min-height:22px;
  padding:2px 3px!important;
  font-size:10px!important;
}

.character-sheet .traits-macro .trait-head{
  display:grid;
  grid-template-columns:minmax(0,1fr) 10px 42px 25px;
  column-gap:3px;
  min-height:22px;
  padding:2px 3px;
  align-items:center;
  color:var(--ui-secondary,var(--muted));
  font-size:10px;
  font-weight:650;
  letter-spacing:.035em;
  text-align:center;
  text-transform:uppercase;
}

.character-sheet .traits-macro .trait-head > span:first-child{
  grid-column:1;
}

.character-sheet .traits-macro .trait-head > span:last-child{
  grid-column:3;
}

.character-sheet .traits-macro .list-row input,
.character-sheet .traits-macro .skill-row input,
.character-sheet .traits-macro .skill-row select{
  height:25px!important;
  min-height:25px!important;
  border-radius:0!important;
  font-size:11px!important;
}

.character-sheet .traits-macro .skill-row select[data-skill-prop="attribute"]{
  min-width:60px;
  padding-left:5px!important;
  padding-right:18px!important;
}

.character-sheet .traits-macro .level-button,
.character-sheet .traits-macro .skill-total,
.character-sheet .traits-macro .manual-skill-points{
  border-radius:0!important;
  box-shadow:none!important;
}

.character-sheet .traits-macro .skill-list .skill-row:nth-child(odd),
.character-sheet .traits-macro #advantages .list-row:nth-child(odd),
.character-sheet .traits-paper-row.stripe-a{
  background:var(--row-stripe-a)!important;
}

.character-sheet .traits-macro .skill-list .skill-row:nth-child(even),
.character-sheet .traits-macro #advantages .list-row:nth-child(even),
.character-sheet .traits-paper-row.stripe-b{
  background:var(--row-stripe-b)!important;
}

.character-sheet .traits-macro #disadvantages[data-first-stripe="a"] .list-row:nth-child(odd),
.character-sheet .traits-macro #disadvantages[data-first-stripe="b"] .list-row:nth-child(even){
  background:var(--row-stripe-a)!important;
}

.character-sheet .traits-macro #disadvantages[data-first-stripe="a"] .list-row:nth-child(even),
.character-sheet .traits-macro #disadvantages[data-first-stripe="b"] .list-row:nth-child(odd){
  background:var(--row-stripe-b)!important;
}

.character-sheet .traits-paper-row{
  height:30px;
  min-height:30px;
  box-sizing:border-box;
  border-bottom:0;
}

  .character-sheet .traits-macro .add-row{
    height:30px;
    min-height:30px;
    margin-top:0!important;
    border-radius:0!important;
  }

  .character-sheet .traits-paper-fill{
    display:block;
  }

  #editorView.view-mode .character-sheet .traits-macro .skill-head,
  #editorView.view-mode .character-sheet .traits-macro .skill-row{
    grid-template-columns:minmax(145px,1fr) 60px 54px 48px 68px 44px!important;
  }

  #editorView.view-mode .character-sheet .traits-macro .view-empty-row{
    display:grid!important;
  }

  #editorView.view-mode .character-sheet .traits-macro .view-empty-row > *{
    visibility:hidden!important;
    pointer-events:none!important;
  }
}

/* Inventory remains feature-complete, but belongs to one sheet boundary. */
.character-sheet .inventory-block{
  width:100%;
}

.character-sheet .inventory-summary{
  display:grid!important;
  grid-template-columns:1.7fr .75fr .85fr .85fr!important;
  gap:0!important;
}

.character-sheet .inventory-summary > span{
  min-height:34px;
  border-radius:0;
  background:transparent;
}

.character-sheet .inventory-section{
  margin-top:0;
  border:0;
  border-top:1px solid var(--ui-border);
  border-radius:0!important;
}

.character-sheet .inventory-block > .block-body{
  padding:0!important;
}

.character-sheet .inventory-section-title{
  min-height:27px;
  margin:5px 8px 0;
  padding:3px 34px 3px 5px;
  border-bottom:1px solid var(--ui-border);
  color:var(--ui-text);
  background:transparent;
  font-family:var(--font-heading);
  font-size:11px;
  line-height:1.25;
}

.character-sheet .inventory-section-title > strong{
  font-size:11px;
  font-weight:700;
  letter-spacing:.01em;
  text-transform:none;
}

.character-sheet .inventory-section-title::after{
  border:0;
  border-radius:0;
  color:var(--ui-secondary);
  background:transparent;
}

.character-sheet .inventory-section-title .compact-add{
  width:auto!important;
  min-height:21px!important;
  margin:0!important;
  padding:2px 6px!important;
  border:1px solid var(--ui-border)!important;
  border-radius:0!important;
  background:transparent;
  font-size:10px!important;
  line-height:1.2;
}

.character-sheet .inventory-summary{
  padding:4px 8px;
  margin:0;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
}

.character-sheet .inventory-summary > span{
  padding:4px 6px;
  border:0;
}

/* Flat inventory table: unit values and calculated totals share one row. */
.character-sheet .inventory-section-body{
  margin-inline:8px;
  padding-bottom:0;
  overflow-x:auto;
  overscroll-behavior-inline:contain;
}

.character-sheet .inventory-head,
.character-sheet .inventory-main,
#editorView.view-mode .character-sheet .inventory-main{
  display:grid!important;
  grid-template-columns:46px minmax(220px,1fr) 48px 60px 60px 74px 74px 190px 30px!important;
  gap:0!important;
  align-items:stretch!important;
  min-width:0;
}

.character-sheet .inventory-head{
  min-height:24px;
  padding:0!important;
  border-bottom:1px solid var(--ui-border);
  background:color-mix(in srgb,var(--ui-paper,var(--paper)) 74%,var(--ui-surface-soft));
  color:var(--ui-secondary,var(--muted));
}

.character-sheet .inventory-head > span{
  display:flex;
  min-width:0;
  min-height:24px;
  padding:3px 5px;
  align-items:center;
  justify-content:center;
  border-right:0;
  text-align:center;
  line-height:1.05;
}

.character-sheet .inventory-head > span:nth-child(2){
  justify-content:flex-start;
  text-align:left;
}

.character-sheet .inventory-head > span:last-child{
  border-right:0;
}

.character-sheet .inventory-item,
.character-sheet .inventory-section-body > .inventory-item{
  margin:0!important;
  padding:0!important;
  border:0!important;
  border-radius:0!important;
  box-shadow:none!important;
  overflow:visible!important;
}

.character-sheet .inventory-item + .inventory-item{
  border-top:1px solid var(--ui-border)!important;
}

.character-sheet .inventory-item.is-open{
  box-shadow:none!important;
}

.character-sheet .item-config-panel{
  min-width:0;
  margin-top:0!important;
  padding:0!important;
  gap:0!important;
  border-top:1px solid var(--ui-border)!important;
}

.character-sheet .inventory-main,
#editorView.view-mode .character-sheet .inventory-main{
  height:29px;
  min-height:29px!important;
  padding:0!important;
}

.character-sheet .inventory-main > .inventory-field,
.character-sheet .inventory-main > .inventory-total-field,
.character-sheet .inventory-main > .inventory-move-actions,
.character-sheet .inventory-main > .inventory-remove{
  min-width:0;
  border-right:0!important;
}

.character-sheet .inventory-main > .inventory-remove{
  border-right:0!important;
}

.character-sheet .inventory-field{
  display:flex!important;
  grid-template:none!important;
  gap:0!important;
  width:100%!important;
  height:29px!important;
  min-height:29px!important;
  align-items:stretch!important;
}

.character-sheet .inventory-main input,
.character-sheet .inventory-main select{
  width:100%!important;
  height:29px!important;
  min-height:29px!important;
  margin:0!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
}

.character-sheet .inventory-main input:focus,
.character-sheet .inventory-main select:focus{
  outline:2px solid var(--ui-accent)!important;
  outline-offset:-2px!important;
}

.character-sheet .inventory-name-line,
.character-sheet .inventory-name-line.has-expand{
  width:100%;
  height:29px;
  grid-template-columns:minmax(0,1fr) 28px!important;
  gap:0!important;
}

.character-sheet .inventory-name-line .item-expand{
  width:28px!important;
  height:29px!important;
  min-height:29px!important;
  border:0!important;
  border-left:0!important;
  border-radius:0!important;
  background:transparent!important;
}

.character-sheet .inventory-total-field{
  display:flex;
  width:100%;
  height:29px;
  min-height:29px;
  align-items:stretch;
}

.character-sheet .inventory-total-value{
  display:flex;
  width:100%;
  min-width:0;
  height:29px;
  min-height:29px!important;
  border:0!important;
  background:transparent!important;
  padding:2px 3px;
  align-items:center;
  justify-content:center;
  color:var(--ui-text);
  font-family:var(--font-value)!important;
  font-size:11px;
  font-weight:750;
  line-height:1;
  text-align:center;
  font-variant-numeric:tabular-nums lining-nums;
}

.character-sheet .inventory-move-actions{
  display:flex!important;
  width:100%;
  height:29px;
  min-height:29px;
  gap:0!important;
  align-items:stretch;
}

.character-sheet .inventory-move-actions .item-move-group{
  display:flex;
  flex:1 1 0;
  min-width:0;
  height:29px;
  align-items:stretch;
}

.character-sheet .inventory-move-actions .item-move-group + .item-move-group{
  border-left:0;
}

.character-sheet .inventory-move-actions .item-move-group:first-child:not(:only-child){
  flex:0 0 54px;
}

.character-sheet .inventory-move-actions .item-move{
  flex:1 1 0;
  width:auto!important;
  min-width:0!important;
  height:29px!important;
  min-height:29px!important;
  padding:1px 3px!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  font-size:9.5px!important;
  line-height:1.05!important;
  white-space:nowrap!important;
}

.character-sheet .inventory-move-actions .item-move-part{
  flex:0 0 44px;
  min-width:0;
  height:29px;
  min-height:29px;
  padding:1px 2px;
  border:0;
  border-left:0!important;
  border-radius:0;
  background:transparent;
  font-size:9.5px;
  line-height:1.05;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.character-sheet .inventory-move-actions .item-move:hover,
.character-sheet .inventory-move-actions .item-move:focus-visible,
.character-sheet .inventory-move-actions .item-move-part:hover,
.character-sheet .inventory-move-actions .item-move-part:focus-visible,
.character-sheet .inventory-name-line .item-expand:hover,
.character-sheet .inventory-remove:hover{
  background:var(--ui-hover)!important;
}

.character-sheet .inventory-remove{
  width:30px!important;
  height:29px!important;
  min-height:29px!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
}

.character-sheet .money-head,
.character-sheet #moneyList .money-row,
#editorView.view-mode .character-sheet #moneyList .money-row{
  gap:0;
  padding:0;
  border-radius:0;
}

.character-sheet .money-head{
  min-height:24px;
  border-bottom:1px solid var(--ui-border);
  color:var(--ui-secondary);
  background:color-mix(in srgb,var(--ui-paper,var(--paper)) 74%,var(--ui-surface-soft));
}

.character-sheet .money-head > span{
  padding:3px 5px;
}

.character-sheet .money-head > span:first-child{
  text-align:left;
}

.character-sheet #moneyList .money-row{
  min-height:29px;
  border:0;
  border-bottom:1px solid var(--ui-border);
}

.character-sheet #moneyList .money-row:last-child{
  border-bottom:0;
}

.character-sheet #moneyList .money-row input{
  height:29px;
  padding:2px 5px;
  border:0;
  border-radius:0;
  background:transparent!important;
}

/* Inventory weapon profiles use the same flat table language as the Attacks block. */
.character-sheet .weapon-config-flat{
  gap:0!important;
}

.character-sheet .weapon-config-edit > .item-detail-toolbar{
  min-height:25px!important;
  padding:0 2px!important;
  border-bottom:1px solid var(--ui-border)!important;
}

.character-sheet .weapon-config-view > .item-detail-toolbar{
  display:none!important;
}

.character-sheet .weapon-profile-add-actions{
  display:flex;
  flex-wrap:wrap;
  justify-content:flex-end;
  gap:4px;
}

.character-sheet .weapon-profile-add-actions .compact-add{
  width:auto!important;
  margin:0!important;
}

.character-sheet .weapon-config-flat .profile-list{
  display:block!important;
  min-width:0;
  padding:0!important;
}

.character-sheet .weapon-profile-section{
  min-width:0;
}

.character-sheet .weapon-profile-section + .weapon-profile-section{
  border-top:1px solid var(--ui-border);
}

.character-sheet .weapon-profile-section-title{
  min-height:23px;
  padding:4px 7px 3px;
  border-bottom:1px solid var(--ui-border);
  color:var(--ui-text);
  background:var(--ui-surface-soft);
  font-family:var(--font-heading)!important;
  font-size:10px;
  font-weight:800;
  letter-spacing:.025em;
  line-height:1.25;
  text-transform:uppercase;
}

.character-sheet .weapon-profile-edit-table,
.character-sheet .weapon-profile-view-table{
  max-width:100%;
  min-width:0;
  overflow-x:auto;
  overscroll-behavior-inline:contain;
}

.character-sheet .weapon-profile-edit-grid{
  display:grid!important;
  width:100%;
  min-width:0;
  grid-template-columns:var(--weapon-profile-edit-columns)!important;
  column-gap:0!important;
  row-gap:0!important;
  align-items:stretch!important;
}

.character-sheet .weapon-profile-edit-grid-melee{
  --weapon-profile-edit-columns:44px minmax(110px,1.1fr) minmax(145px,1.4fr) 52px 44px 48px 70px 60px 76px 56px 58px 52px 28px;
}

.character-sheet .weapon-profile-edit-grid-ranged{
  --weapon-profile-edit-columns:44px minmax(105px,1.05fr) minmax(140px,1.35fr) 52px 44px 48px 68px 44px minmax(96px,.95fr) 44px 54px 52px 48px 48px 28px;
}

.character-sheet .weapon-profile-edit-head{
  min-height:28px;
  border-bottom:1px solid var(--ui-border);
  background:color-mix(in srgb,var(--ui-paper,var(--paper)) 74%,var(--ui-surface-soft));
}

.character-sheet .weapon-profile-edit-heading{
  display:flex;
  min-width:0;
  padding:3px 5px;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  color:var(--ui-secondary,var(--muted));
  font-family:var(--font-heading)!important;
  font-size:9.5px;
  font-weight:750;
  letter-spacing:.015em;
  line-height:1.1;
  text-align:center;
  overflow-wrap:anywhere;
  text-overflow:clip;
  text-transform:uppercase;
  white-space:normal;
}

.character-sheet .weapon-profile-edit-heading + .weapon-profile-edit-heading,
.character-sheet .weapon-profile-edit-row > * + *{
  border-left:0!important;
}

.character-sheet .weapon-profile-edit-body > .weapon-profile{
  margin:0!important;
  padding:0!important;
  overflow:visible!important;
  border:0!important;
  border-bottom:1px solid var(--ui-border)!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
}

.character-sheet .weapon-profile-edit-body > .weapon-profile:last-child{
  border-bottom:0!important;
}

.character-sheet .weapon-profile-edit-body > .weapon-profile:nth-child(odd) .weapon-profile-edit-row{
  background:var(--row-stripe-a)!important;
}

.character-sheet .weapon-profile-edit-body > .weapon-profile:nth-child(even) .weapon-profile-edit-row{
  background:var(--row-stripe-b)!important;
}

.character-sheet .weapon-profile-edit-row{
  min-height:31px;
}

.character-sheet .weapon-profile-edit-row > .profile-field,
.character-sheet .weapon-profile-used{
  position:relative;
  display:flex!important;
  min-width:0!important;
  min-height:31px!important;
  margin:0!important;
  padding:0!important;
  align-items:stretch;
}

.character-sheet .weapon-profile-used{
  align-items:center!important;
  justify-content:center;
  cursor:pointer;
}

.character-sheet .weapon-profile-used input{
  width:13px!important;
  height:13px!important;
  min-height:13px!important;
  margin:0!important;
}

.character-sheet .weapon-profile-edit-row > .profile-field > label,
.character-sheet .weapon-profile-used > span{
  position:absolute!important;
  width:1px!important;
  height:1px!important;
  padding:0!important;
  overflow:hidden!important;
  clip:rect(0,0,0,0)!important;
  white-space:nowrap!important;
}

.character-sheet .weapon-profile-edit-row input:not([type="checkbox"]),
.character-sheet .weapon-profile-edit-row select{
  width:100%!important;
  height:31px!important;
  min-height:31px!important;
  margin:0!important;
  padding:2px 3px!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
  color:var(--ui-text)!important;
  font-size:9.5px!important;
  line-height:1.1!important;
  text-align:center;
}

.character-sheet .weapon-profile-edit-row .profile-name-field input,
.character-sheet .weapon-profile-edit-row .profile-skill-field select{
  padding-inline:5px!important;
  text-align:left;
}

.character-sheet .weapon-profile-edit-row input:focus,
.character-sheet .weapon-profile-edit-row select:focus{
  outline:2px solid var(--ui-accent)!important;
  outline-offset:-2px!important;
}

.character-sheet .weapon-profile-edit-row .profile-parry-preview{
  display:flex;
  width:100%;
  min-width:0;
  min-height:31px;
  padding:2px 3px;
  align-items:center;
  justify-content:center;
  color:var(--ui-value,var(--gold));
  font-family:var(--font-value)!important;
  font-size:11px;
  font-weight:800;
  line-height:1;
  text-align:center;
}

.character-sheet .weapon-profile-remove{
  width:28px!important;
  height:31px!important;
  min-height:31px!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
}

.character-sheet .weapon-profile-remove:hover{
  background:var(--ui-hover)!important;
}

.character-sheet .weapon-profile-view-table .weapon-profile-view-row{
  min-height:30px;
  margin:0!important;
  padding:0!important;
  border:0!important;
  border-bottom:1px solid var(--ui-border)!important;
  border-radius:0!important;
  box-shadow:none!important;
}

.character-sheet .weapon-profile-view-table .weapon-profile-view-row:last-child{
  border-bottom:0!important;
}

.character-sheet .weapon-profile-view-table .weapon-profile-view-row.attack-stripe-a{
  background:var(--row-stripe-a)!important;
}

.character-sheet .weapon-profile-view-table .weapon-profile-view-row.attack-stripe-b{
  background:var(--row-stripe-b)!important;
}

.character-sheet .weapon-profile-view-table .attack-card-head,
.character-sheet .weapon-profile-view-table .attack-stat{
  display:flex!important;
  min-width:0;
  min-height:30px!important;
  padding:3px 4px!important;
  align-items:center;
  justify-content:center;
  border-radius:0!important;
  background:transparent!important;
  text-align:center;
}

.character-sheet .weapon-profile-view-table .weapon-profile-mode strong{
  min-width:0;
  overflow:hidden;
  font-size:10.5px!important;
  line-height:1.15!important;
  text-overflow:ellipsis;
  white-space:nowrap;
}

/* Armor settings are one connected paper-table row with readable labels. */
.character-sheet .armor-config-flat{
  display:grid!important;
  min-width:0!important;
  grid-template-columns:150px 145px minmax(0,1fr)!important;
  gap:0!important;
  align-items:stretch!important;
  border-top:0!important;
  border-bottom:0!important;
}

.character-sheet .armor-config-flat > .item-detail-label{
  display:flex;
  min-width:0;
  min-height:31px;
  padding:4px 7px!important;
  align-items:center!important;
  border-right:1px solid var(--ui-border);
  font-size:10.5px!important;
  line-height:1.15!important;
  white-space:nowrap!important;
}

.character-sheet .armor-config-flat > .armor-config-body{
  display:contents!important;
}

.character-sheet .armor-config-flat .armor-core-fields-flat{
  display:block!important;
  min-width:0;
  margin:0!important;
  border-right:1px solid var(--ui-border);
}

.character-sheet .armor-config-flat .armor-core-fields-flat .profile-field{
  display:grid!important;
  min-width:0!important;
  min-height:31px!important;
  grid-template-columns:70px minmax(0,1fr)!important;
  gap:0!important;
  align-items:stretch!important;
}

.character-sheet .armor-config-flat .armor-core-fields-flat .profile-field > label{
  display:flex;
  min-width:0;
  margin:0!important;
  padding:3px 5px!important;
  align-items:center;
  color:var(--ui-secondary)!important;
  font-family:var(--font-heading)!important;
  font-size:9.5px!important;
  font-weight:750!important;
  letter-spacing:.02em!important;
  line-height:1.15!important;
  text-transform:uppercase;
  white-space:normal!important;
}

.character-sheet .armor-config-flat .armor-core-fields-flat input{
  width:100%!important;
  min-width:0!important;
  height:31px!important;
  min-height:31px!important;
  margin:0!important;
  padding:3px 5px!important;
  border:0!important;
  border-left:1px solid var(--ui-border)!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
  color:var(--ui-text)!important;
  font-size:11px!important;
  font-weight:700!important;
  line-height:1.2!important;
  text-align:center;
}

.character-sheet .armor-config-flat .armor-core-fields-flat input:focus{
  outline:2px solid var(--ui-accent)!important;
  outline-offset:-2px!important;
}

.character-sheet .armor-config-flat .armor-locations{
  display:grid!important;
  min-width:0!important;
  min-height:31px!important;
  margin:0!important;
  padding:3px 7px!important;
  grid-template-columns:auto repeat(6,minmax(54px,1fr))!important;
  gap:4px 8px!important;
  align-items:center!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
}

.character-sheet .armor-config-flat .armor-locations-title{
  min-width:0;
  margin:0 2px 0 0!important;
  padding:0!important;
  align-self:center!important;
  color:var(--ui-secondary)!important;
  font-family:var(--font-heading)!important;
  font-size:9.5px!important;
  font-weight:750!important;
  letter-spacing:.02em!important;
  line-height:1.15!important;
  text-transform:uppercase;
  white-space:nowrap!important;
}

.character-sheet .armor-config-flat .armor-location-toggle{
  display:flex!important;
  min-width:0!important;
  margin:0!important;
  gap:4px!important;
  align-items:center!important;
  color:var(--ui-text)!important;
  font-size:10px!important;
  font-weight:650!important;
  line-height:1.2!important;
  white-space:nowrap!important;
}

.character-sheet .armor-config-flat .armor-location-toggle input{
  width:15px!important;
  min-width:15px!important;
  height:15px!important;
  min-height:15px!important;
  margin:0!important;
}

@media screen and (max-width:820px){
  .character-sheet .armor-config-flat{
    grid-template-columns:minmax(0,1fr) 145px!important;
  }

  .character-sheet .armor-config-flat .armor-core-fields-flat{
    border-right:0;
  }

  .character-sheet .armor-config-flat .armor-locations{
    grid-column:1 / -1!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:5px 8px!important;
    padding:5px 7px!important;
    border-top:1px solid var(--ui-border)!important;
  }

  .character-sheet .armor-config-flat .armor-locations-title{
    grid-column:1 / -1!important;
    grid-row:auto!important;
  }
}

@media screen and (max-width:430px){
  .character-sheet .armor-config-flat .armor-locations{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
}

.character-sheet .item-config-panel > * + *{
  border-top:1px solid var(--ui-border)!important;
}

/* Item descriptions follow the same addable, single-row table pattern as other lists. */
.character-sheet .item-description-section{
  display:grid;
  min-width:0;
  gap:0;
}

.character-sheet .item-description-toolbar,
.character-sheet .item-description-view > .item-detail-label{
  display:flex!important;
  min-height:25px!important;
  padding:0 2px!important;
  align-items:center;
}

.character-sheet .item-description-edit.has-lines > .item-description-toolbar,
.character-sheet .item-description-view > .item-detail-label{
  border-bottom:1px solid var(--ui-border)!important;
}

.character-sheet .item-description-toolbar .compact-add{
  min-height:23px!important;
  padding:2px 7px!important;
  border:0!important;
  border-left:1px solid var(--ui-border)!important;
  border-radius:0!important;
  background:transparent!important;
  font-size:9.5px!important;
}

.character-sheet .item-description-list{
  display:grid;
  min-width:0;
}

.character-sheet .item-description-row{
  display:grid;
  min-width:0;
  min-height:29px;
  grid-template-columns:minmax(0,1fr) 28px;
  align-items:stretch;
}

.character-sheet .item-description-row:nth-child(odd),
.character-sheet .item-description-view-row:nth-child(odd){
  background:var(--row-stripe-a);
}

.character-sheet .item-description-row:nth-child(even),
.character-sheet .item-description-view-row:nth-child(even){
  background:var(--row-stripe-b);
}

.character-sheet .item-description-row + .item-description-row,
.character-sheet .item-description-view-row + .item-description-view-row{
  border-top:1px solid var(--ui-border);
}

.character-sheet .item-description-row input{
  width:100%!important;
  min-width:0!important;
  height:29px!important;
  min-height:29px!important;
  margin:0!important;
  padding:3px 7px!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
  color:var(--ui-text)!important;
  font-size:11px!important;
  line-height:1.2!important;
  text-align:left!important;
}

.character-sheet .item-description-row input:focus{
  outline:2px solid var(--ui-accent)!important;
  outline-offset:-2px!important;
}

.character-sheet .item-description-remove{
  width:28px!important;
  height:29px!important;
  min-height:29px!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  border-left:1px solid var(--ui-border)!important;
  border-radius:0!important;
  background:transparent!important;
}

.character-sheet .item-description-remove:hover,
.character-sheet .item-description-toolbar .compact-add:hover{
  background:var(--ui-hover)!important;
}

.character-sheet .item-description-view-row{
  min-width:0;
  min-height:29px;
  padding:5px 7px 4px;
  color:var(--ui-text);
  font-size:11px;
  line-height:1.25;
  overflow-wrap:anywhere;
}

.character-sheet #journalDetails{
  margin-top:8px;
}

/* Read mode keeps the same geometry and sheds edit chrome. */
#editorView.view-mode .character-sheet .reaction-row input,
#editorView.view-mode .character-sheet .cultural-row input,
#editorView.view-mode .character-sheet .language-row input,
#editorView.view-mode .character-sheet .language-row select,
#editorView.view-mode .character-sheet .tl-row input{
  border-color:transparent!important;
  background:transparent!important;
  box-shadow:none!important;
}

#editorView.view-mode .character-sheet .language-row-points{
  border-color:transparent;
  background:transparent;
}

#editorView.view-mode .character-sheet .identity-bar .field input,
#editorView.view-mode .character-sheet .identity-unspent input{
  border-color:transparent!important;
  border-bottom-color:var(--ui-border)!important;
  background:transparent!important;
}

/* Tablet: preserve relationships, then reflow without turning regions into cards. */
@media screen and (max-width:1100px){
  .character-sheet .identity-bar{
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
  }

  .character-sheet .identity-name,
  .character-sheet .identity-appearance{
    grid-column:span 2;
  }

  .character-sheet .physical-macro{
    grid-template-columns:minmax(0,1.15fr) minmax(280px,.85fr)!important;
    grid-template-areas:
      "stats portrait"
      "encumbrance dr"
      "defenses defenses"!important;
    grid-template-rows:auto auto auto!important;
  }

  .character-sheet .physical-macro .characteristics-card,
  .character-sheet .physical-macro .dashboard-encumbrance,
  .character-sheet .physical-macro .armor-defense-card,
  .character-sheet .physical-macro .portrait-card{
    border-bottom:1px solid var(--ui-border)!important;
  }

  .character-sheet .portrait-card .portrait{
    height:310px!important;
    min-height:310px!important;
    max-height:310px!important;
  }

  .character-sheet .social-macro{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }

  .character-sheet .culture-card{
    grid-column:1 / -1;
    border-top:1px solid var(--ui-border)!important;
    border-left:0!important;
  }
}

@media screen and (max-width:760px){
  .character-sheet{
    width:100%;
    margin:0;
    padding:7px;
    border-radius:0;
  }

  .character-sheet .identity-bar{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }

  .character-sheet .identity-name,
  .character-sheet .identity-appearance{
    grid-column:1 / -1;
  }

  .character-sheet .identity-points{
    grid-column:1 / -1;
    grid-template-columns:70px minmax(0,1fr);
  }

  .character-sheet .physical-macro{
    grid-template-columns:minmax(0,1fr)!important;
    grid-template-areas:
      "stats"
      "encumbrance"
      "dr"
      "defenses"
      "portrait"!important;
    grid-template-rows:auto!important;
  }

  .character-sheet .physical-macro .characteristics-card,
  .character-sheet .physical-macro .dashboard-encumbrance,
  .character-sheet .physical-macro .armor-defense-card,
  .character-sheet .physical-macro .active-defense-card{
    border-right:0!important;
    border-bottom:1px solid var(--ui-border)!important;
  }

  .character-sheet .stat-column-head,
  .character-sheet .stat-pair{
    grid-template-columns:28px 58px 37px 38px 58px 58px 37px!important;
    gap:3px!important;
  }

  .character-sheet .stat-label{
    font-size:19px!important;
  }

  .character-sheet .derived-row{
    grid-template-columns:minmax(0,1fr)!important;
  }

  .character-sheet .portrait-card{
    width:min(100%,294px)!important;
    justify-self:center;
  }

  .character-sheet .portrait-card .portrait{
    height:332px!important;
    min-height:332px!important;
    max-height:332px!important;
  }

  .character-sheet .social-macro,
  .character-sheet .traits-macro{
    grid-template-columns:minmax(0,1fr)!important;
  }

  .character-sheet .social-macro > .social-cell + .social-cell,
  .character-sheet .traits-column{
    border-top:1px solid var(--ui-border)!important;
    border-left:0!important;
    border-right:0!important;
  }

  .character-sheet .language-superhead{
    display:none!important;
  }

  .character-sheet .language-row{
    grid-template-columns:minmax(0,1fr) minmax(82px,.7fr) 40px 24px!important;
  }

  .character-sheet .language-name-field{
    grid-column:1 / -1;
  }

  .character-sheet .language-row label:nth-of-type(2){grid-column:1}
  .character-sheet .language-row label:nth-of-type(3){grid-column:2}

  .character-sheet .active-defense-card .defense-grid{
    grid-template-columns:minmax(0,1fr)!important;
  }

  .character-sheet .inventory-summary{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }

  .character-sheet .inventory-section-body{
    overflow:visible;
  }

  .character-sheet .inventory-head{
    display:none!important;
  }

  .character-sheet .inventory-main,
  #editorView.view-mode .character-sheet .inventory-main{
    grid-template-columns:repeat(6,minmax(0,1fr))!important;
    height:auto;
    min-height:0!important;
  }

  .character-sheet .inventory-main > .inventory-field,
  .character-sheet .inventory-main > .inventory-total-field,
  .character-sheet .inventory-main > .inventory-move-actions,
  .character-sheet .inventory-main > .inventory-remove{
    border-right:0!important;
    border-bottom:1px solid var(--ui-border)!important;
  }

  .character-sheet .inventory-type-field,
  .character-sheet .inventory-name-field,
  .character-sheet .inventory-remove{
    min-height:29px!important;
  }

  .character-sheet .inventory-type-field{
    grid-column:1!important;
    grid-row:1!important;
    width:100%!important;
    min-width:0!important;
  }
  .character-sheet .inventory-name-field{grid-column:2 / 6!important;grid-row:1!important}
  .character-sheet .inventory-remove{
    grid-column:6!important;
    grid-row:1!important;
    position:static!important;
    inset:auto!important;
    width:auto!important;
    min-width:0!important;
    align-self:stretch!important;
    justify-self:stretch!important;
  }
  .character-sheet .inventory-qty-field{grid-column:1 / 3!important;grid-row:2!important}
  .character-sheet .inventory-weight-field{grid-column:3 / 5!important;grid-row:2!important}
  .character-sheet .inventory-weight-total-field{grid-column:5 / 7!important;grid-row:2!important}
  .character-sheet .inventory-price-field{grid-column:1 / 4!important;grid-row:3!important}
  .character-sheet .inventory-cost-total-field{grid-column:4 / 7!important;grid-row:3!important}
  .character-sheet .inventory-move-actions{grid-column:1 / -1!important;grid-row:4!important}

  .character-sheet .inventory-type-field .item-type-select,
  .character-sheet .inventory-type-field .item-type-icon-display,
  .character-sheet .inventory-type-field .item-type-badges,
  .character-sheet .inventory-type-field .item-type-badge{
    width:100%!important;
    min-width:0!important;
  }

  .character-sheet .inventory-qty-field,
  .character-sheet .inventory-weight-field,
  .character-sheet .inventory-price-field,
  .character-sheet .inventory-total-field{
    display:grid!important;
    grid-template-columns:minmax(0,1fr);
    justify-content:stretch;
    grid-template-rows:14px 29px!important;
    height:43px!important;
    min-height:43px!important;
  }

  .character-sheet .inventory-mobile-label{
    display:block!important;
    min-width:0;
    padding:1px 4px 0;
    color:var(--ui-secondary);
    font-size:9.5px!important;
    line-height:13px;
    text-align:left;
    text-transform:uppercase;
  }

  .character-sheet .inventory-type-field .inventory-mobile-label,
  .character-sheet .inventory-name-field .inventory-mobile-label{
    display:none!important;
  }

  .character-sheet .inventory-total-value{
    height:29px;
  }

  .character-sheet .inventory-move-actions{
    height:29px;
    min-height:29px;
    padding-top:0;
  }

  .character-sheet .inventory-weight-total-field,
  .character-sheet .inventory-cost-total-field,
  .character-sheet .inventory-move-actions{
    border-right:0!important;
  }

  .character-sheet .inventory-main > .inventory-remove{
    border-right:0!important;
    border-bottom:1px solid var(--ui-border)!important;
  }

  #editorView.view-mode .character-sheet .inventory-name-field{
    grid-column:2 / -1!important;
  }
}

@media screen and (max-width:1000px){
  .character-sheet .attack-table{
    max-width:100%;
    overflow-x:auto;
    overscroll-behavior-inline:contain;
  }

  .character-sheet .attack-table-melee .attack-table-row{
    min-width:760px;
  }

  .character-sheet .attack-table-ranged .attack-table-row{
    min-width:1040px;
  }
}

@media screen and (max-width:420px){
  .character-sheet .stat-column-head{
    display:none!important;
  }

  .character-sheet .stat-pair{
    grid-template-columns:25px 50px 34px 34px 50px 50px 34px!important;
    gap:2px!important;
  }

  .character-sheet .stat-value,
  .character-sheet .stat-current{
    padding-inline:1px!important;
    font-size:15px!important;
  }

  .character-sheet .armor-defense-card .dr-grid{
    grid-template-columns:minmax(0,1fr)!important;
    grid-template-rows:auto!important;
  }

  .character-sheet .culture-superhead{
    grid-template-columns:minmax(0,1fr) auto 50px 40px;
  }
}

@page{
  size:A4 portrait;
  margin:0;
}

@media print{
  html.print-mode,
  html.print-mode body{
    width:auto!important;
    min-width:0!important;
    margin:0!important;
    padding:0!important;
    overflow:visible!important;
    color:var(--ui-text,var(--ink))!important;
    background:#fff!important;
    -webkit-print-color-adjust:exact;
    print-color-adjust:exact;
  }

  html.print-mode body{
    font-size:14px!important;
    line-height:1.3!important;
  }

  html.print-mode .character-sheet,
  html.print-mode .character-sheet *{
    animation:none!important;
    transition:none!important;
  }

  .manager-screen,
  .toolbar,
  .settings-modal,
  .character-name-modal,
  .compat-warning,
  .cloud-sync-ui,
  .guest-mode-banner,
  .local-save-banner,
  .campaign-ui,
  .app-section-tabs{
    display:none!important;
  }

  html.print-mode #editorView{
    display:block!important;
    width:794px!important;
    min-width:794px!important;
    margin:0!important;
    padding:0!important;
    overflow:visible!important;
  }

  .character-sheet{
    width:1180px!important;
    min-width:1180px!important;
    max-width:1180px!important;
    margin:0!important;
    padding:12px 13px 14px!important;
    overflow:visible!important;
    border:1px solid #b9b1a3!important;
    background:var(--ui-paper,var(--paper))!important;
    box-shadow:none!important;
    font-size:12px!important;
    line-height:1.28!important;
    zoom:.673;
  }

  html.print-mode .character-sheet .macro-collapse-btn,
  html.print-mode .character-sheet .collapse-btn,
  html.print-mode .character-sheet .edit-only-control,
  html.print-mode .character-sheet .add-row,
  html.print-mode .character-sheet .remove,
  html.print-mode .character-sheet .level-button,
  html.print-mode .character-sheet .portrait-actions,
  html.print-mode #editorView.view-mode .character-sheet .custom-attack-actions,
  html.print-mode #editorView.view-mode .character-sheet .custom-attack-editor,
  html.print-mode .character-sheet .weapon-config,
  html.print-mode .character-sheet .inventory-weapon-field,
  html.print-mode .character-sheet .bag-toggle{
    display:none!important;
  }

  html.print-mode .character-sheet input[type="number"]{
    appearance:textfield!important;
    -webkit-appearance:textfield!important;
  }

  html.print-mode .character-sheet input[type="number"]::-webkit-inner-spin-button,
  html.print-mode .character-sheet input[type="number"]::-webkit-outer-spin-button{
    margin:0!important;
    -webkit-appearance:none!important;
  }

  html.print-mode #editorView.view-mode .character-sheet .stat-value,
  html.print-mode #editorView.view-mode .character-sheet .stat-current,
  html.print-mode #editorView.view-mode .character-sheet .characteristics-card .stat-current.is-low-hp,
  html.print-mode #editorView.view-mode .character-sheet .characteristics-card .stat-current.is-low-fp{
    box-shadow:none!important;
  }

  html.print-mode .character-sheet .inventory-section-title::after,
  html.print-mode .character-sheet .item-config-title::after,
  html.print-mode .character-sheet summary::after{
    display:none!important;
    content:none!important;
  }

  html.print-mode .character-sheet .inventory-head,
  html.print-mode .character-sheet .inventory-main,
  html.print-mode #editorView.view-mode .character-sheet .inventory-main{
    grid-template-columns:9mm minmax(48mm,1fr) 8mm 11mm 11mm 13mm 14mm!important;
    min-width:0!important;
  }

  html.print-mode .character-sheet .inventory-head > :nth-child(8),
  html.print-mode .character-sheet .inventory-head > :nth-child(9),
  html.print-mode .character-sheet .inventory-move-actions,
  html.print-mode .character-sheet .inventory-remove,
  html.print-mode .character-sheet .item-expand{
    display:none!important;
  }

  html.print-mode .character-sheet .inventory-name-line,
  html.print-mode .character-sheet .inventory-name-line.has-expand{
    grid-template-columns:minmax(0,1fr)!important;
  }

  html.print-mode .character-sheet .list-row,
  html.print-mode .character-sheet .skill-row,
  html.print-mode .character-sheet .traits-paper-row,
  html.print-mode .character-sheet .reaction-row,
  html.print-mode .character-sheet .language-row,
  html.print-mode .character-sheet .cultural-row,
  html.print-mode .character-sheet .attack-card,
  html.print-mode .character-sheet .inventory-item,
  html.print-mode .character-sheet .money-row{
    break-inside:avoid!important;
    page-break-inside:avoid!important;
  }

  .character-sheet .physical-macro.collapsed > .dashboard-column,
  .character-sheet .social-macro.collapsed > .social-cell,
  .character-sheet .traits-macro.collapsed > .stack{
    display:contents!important;
  }
}

/* Phone-directory tabs: a straight top and an 8 by 14 px lower cut (60°). */
@media screen{
  #editorView .character-sheet :is(.sheet-macro > .macro-collapse-btn,#journalDetails > summary > .journal-collapse-tab){
    --tab-fill:var(--sheet-heading-fill);
    --tab-shape:polygon(0 0,100% 0,100% calc(100% - 14px),calc(100% - 8px) 100%,0 100%);
    isolation:isolate;
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
    box-shadow:none!important;
    color:var(--ui-text)!important;
    line-height:1!important;
    padding:0 0 4px!important;
    font-size:13px!important;
  }
  #editorView .character-sheet :is(.sheet-macro > .macro-collapse-btn,#journalDetails > summary > .journal-collapse-tab)::before,
  #editorView .character-sheet :is(.sheet-macro > .macro-collapse-btn,#journalDetails > summary > .journal-collapse-tab)::after{
    content:"";
    position:absolute;
    inset:0;
    z-index:-1;
    clip-path:var(--tab-shape);
    background:var(--ui-border-strong,var(--ui-border));
  }
  #editorView .character-sheet :is(.sheet-macro > .macro-collapse-btn,#journalDetails > summary > .journal-collapse-tab)::after{
    inset:1px 1px 1px 0;
    background:var(--tab-fill);
  }
  #editorView .character-sheet :is(.sheet-macro > .macro-collapse-btn,#journalDetails > summary > .journal-collapse-tab):hover{
    color:var(--ui-accent)!important;
  }
  #editorView .character-sheet .sheet-macro > .block-title,
  #editorView .character-sheet .social-macro > .social-cell > .block-title{
    box-sizing:border-box;
    height:27px!important;
    min-height:27px!important;
    padding:0 30px 0 8px!important;
    align-content:center;
  }
  #editorView .character-sheet .social-macro > .social-cell > .block-title{
    padding-right:8px!important;
  }
  #editorView .character-sheet .collapse-chevron{
    position:absolute;
    top:9px;
    left:5px;
    width:6px;
    height:6px;
    border-right:1.5px solid currentColor;
    border-bottom:1.5px solid currentColor;
    font-size:0;
    transform:rotate(225deg);
  }
  #editorView .character-sheet [aria-expanded="false"] > .collapse-chevron{
    top:6px;
    transform:rotate(45deg);
  }
  #editorView .character-sheet :is(.sheet-macro > .macro-collapse-btn,#journalDetails > summary > .journal-collapse-tab):focus-visible{
    --tab-fill:var(--ui-accent-soft);
    outline:2px solid var(--ui-accent)!important;
    outline-offset:2px!important;
  }
  #editorView .character-sheet .sheet-macro.collapsed{
    height:29px!important;
    min-height:29px!important;
    padding:0!important;
  }
  #editorView .character-sheet .sheet-macro.collapsed > .block-title{
    box-sizing:border-box;
    height:27px!important;
    min-height:27px!important;
    padding:5px 30px 5px 8px!important;
    border-bottom:0!important;
  }
  #editorView .character-sheet .sheet-macro.collapsed :is(.attacks-add-actions,.attacks-bonus-control){
    display:none!important;
  }
  #editorView .character-sheet .sheet-macro.collapsed::before{
    box-sizing:border-box;
    height:27px;
    padding:5px 30px 5px 8px;
    font-size:11.5px;
    line-height:17px;
    letter-spacing:.035em;
  }

  /* Nested sections use the same cut, within the existing heading width. */
  #editorView .character-sheet :is(.item-config,#journalDetails) > summary::after{
    content:"";
    right:9px;
    top:50%;
    transform:translateY(-65%) rotate(45deg);
    box-sizing:border-box;
    width:6px;
    height:6px;
    padding:0;
    border:0;
    border-right:1.5px solid currentColor;
    border-bottom:1.5px solid currentColor;
    border-radius:0;
    clip-path:none;
    background:transparent;
    color:var(--ui-text);
    display:flex;
    align-items:center;
    justify-content:center;
    font:600 13px/1 var(--font-ui);
  }
  #editorView .character-sheet :is(.item-config,#journalDetails)[open] > summary::after{
    content:"";
    transform:translateY(-15%) rotate(225deg);
  }
  #editorView .character-sheet :is(.item-config,#journalDetails) > summary:hover::after{
    color:var(--ui-accent);
  }
}
@media screen and (max-width:1100px){
  #editorView .character-sheet :is(.sheet-macro > .macro-collapse-btn,#journalDetails > summary > .journal-collapse-tab){
    top:-1px!important;
    right:0!important;
    width:24px!important;
    height:29px!important;
    min-height:29px!important;
  }
  #editorView .character-sheet :is(.sheet-macro > .macro-collapse-btn,#journalDetails > summary > .journal-collapse-tab)::after{
    left:0;
  }
  #editorView .character-sheet .sheet-macro.collapsed > .macro-collapse-btn{
    top:-1px!important;
    height:29px!important;
    min-height:29px!important;
  }
}

/* The journal is a full-size sheet section; its native summary owns the tab. */
@media screen{
  #editorView .character-sheet #journalDetails > summary{
    box-sizing:border-box;
    height:27px;
    min-height:27px;
    padding:5px 30px 5px 8px;
    border:0;
    background:var(--sheet-heading-fill)!important;
    font-size:11.5px;
    font-weight:800;
    line-height:17px;
    letter-spacing:.035em;
    overflow:visible;
  }
  #editorView .character-sheet #journalDetails > summary::after{
    display:none;
  }
  #editorView .character-sheet #journalDetails > summary .journal-collapse-tab{
    --tab-fill:var(--sheet-heading-fill);
    background:transparent!important;
  }
  #editorView .character-sheet #journalDetails:not([open]){
    height:29px;
    min-height:29px;
  }
  #editorView .character-sheet #journalDetails:not([open]) .collapse-chevron{
    top:6px;
    transform:rotate(45deg);
  }
  #editorView .character-sheet #journalDetails > summary:hover .journal-collapse-tab{
    color:var(--ui-accent)!important;
  }
}

/* Typography roles shared by the paper tables, including print. */
.character-sheet{
  --sheet-text:11px;
  --sheet-caption:9.5px;
  --sheet-heading:11.5px;
}
#editorView .character-sheet :is(.block-title,.defense-title){
  font-size:var(--sheet-heading)!important;
  font-weight:800!important;
  letter-spacing:.035em!important;
}
#editorView .character-sheet :is(.skill-head,.trait-head,.inventory-head,.money-head,
  .attack-table-heading,.weapon-profile-edit-heading,.language-superhead){
  font-size:var(--sheet-caption)!important;
  font-weight:700!important;
  letter-spacing:0!important;
  line-height:1.2!important;
}
#editorView .character-sheet :is(.skill-head,.trait-head,.inventory-head,.money-head){
  font-size:10px!important;
}
.character-sheet .language-superhead > span:first-child{
  font-size:var(--sheet-heading);
  font-weight:800;
  letter-spacing:.035em;
}
.character-sheet :is(.weapon-profile-section-title,.item-detail-label){
  font-size:10px!important;
  font-weight:800!important;
  letter-spacing:.025em!important;
}
.character-sheet :is(.reaction-row,.cultural-row,.language-row) input,
.character-sheet :is(.skill-name,.item-name,.custom-attack-title-input),
.character-sheet .traits-macro .list-row input[data-prop="name"]{
  font-size:var(--sheet-text)!important;
  font-weight:400!important;
  letter-spacing:0!important;
}
.character-sheet :is(.profile-field > label,.journal-grid .field > label,.inventory-mobile-label){
  font-size:var(--sheet-caption)!important;
  font-weight:700!important;
  letter-spacing:.015em!important;
  line-height:1.2!important;
}
.character-sheet .journal-grid textarea{
  font-size:var(--sheet-text)!important;
  font-weight:400!important;
  line-height:1.45!important;
}
.character-sheet input[type="checkbox"]{
  accent-color:var(--ui-accent);
}

/* A floating reading aid never changes the paper grid or its saved data. */
.sheet-name-preview{
  position:fixed;
  z-index:80;
  max-width:min(420px,calc(100vw - 16px));
  padding:6px 8px;
  border:1px solid var(--ui-border-strong);
  color:var(--ui-text);
  background:var(--ui-paper,var(--paper));
  font:400 12px/1.4 var(--font-ui);
  overflow-wrap:anywhere;
  pointer-events:none;
}
@media print{
  .sheet-name-preview{display:none!important}
}

/* Shared screen controls. Keep table-cell geometry and print rules independent.
   Section collapse tabs have their own geometry and are intentionally excluded. */
@media screen{
  #editorView{
    --sheet-action-height:25px;
    --sheet-icon-size:24px;
    --sheet-action-font:10px;
  }

  #editorView .character-sheet :is(button:not(.collapse-btn),.portrait-actions > label),
  #editorView :is(.toolbar,.settings-modal) :is(button,.file-label){
    box-sizing:border-box;
    border-radius:0!important;
    box-shadow:none!important;
    font-family:var(--font-ui)!important;
    font-weight:600!important;
    letter-spacing:0!important;
    text-transform:none!important;
    text-align:center;
    vertical-align:middle;
    transition:background-color .12s ease,color .12s ease,border-color .12s ease;
  }

  #editorView .character-sheet :is(.add-row,.attacks-title-add,.portrait-actions > button,.portrait-actions > label){
    min-height:var(--sheet-action-height)!important;
    padding:3px 7px!important;
    border:1px solid var(--ui-border-strong)!important;
    color:var(--ui-text)!important;
    background:var(--ui-surface-soft)!important;
    font-size:var(--sheet-action-font)!important;
    line-height:17px!important;
  }

  /* Full-width add rows retain the rhythm of the paper table. */
  #editorView .character-sheet :is(.social-macro,.traits-macro) .add-row{
    border-style:dashed!important;
  }

  #editorView .character-sheet #addLanguageBtn{
    width:100%!important;
  }

  #editorView .character-sheet .traits-macro .add-row{
    height:30px;
    min-height:30px!important;
  }

  #editorView .character-sheet :is(.remove:not(.inventory-remove),.level-button,.custom-attack-expand,.custom-attack-delete,.item-description-remove){
    width:var(--sheet-icon-size)!important;
    min-width:var(--sheet-icon-size)!important;
    height:var(--sheet-icon-size)!important;
    min-height:var(--sheet-icon-size)!important;
    padding:0!important;
    border:1px solid var(--ui-border)!important;
    color:var(--ui-text)!important;
    background:var(--ui-surface-soft)!important;
    font-size:14px!important;
    line-height:22px!important;
  }

  /* Center square delete controls within inventory editor cells. */
  #editorView .character-sheet :is(.inventory-remove,.weapon-profile-remove,.item-description-remove){
    align-self:center!important;
    justify-self:center!important;
  }

  #editorView .character-sheet :is(.remove,.custom-attack-delete,.inventory-remove,.weapon-profile-remove,.item-description-remove){
    color:var(--ui-danger,var(--red))!important;
  }

  #editorView .character-sheet :is(.item-move,.item-move-part){
    color:var(--ui-text)!important;
    font-size:9.5px!important;
    line-height:1.2!important;
  }

  #editorView .character-sheet .item-expand{
    color:var(--ui-text)!important;
    font-size:14px!important;
    line-height:27px!important;
  }

  #editorView .character-sheet :is(button:not(.collapse-btn),.portrait-actions > label):hover{
    background:var(--ui-hover)!important;
  }

  #editorView .character-sheet :is(button:not(.collapse-btn),.portrait-actions > label):active{
    background:var(--ui-accent-soft)!important;
  }

  #editorView .character-sheet :is(.remove,.custom-attack-delete,.item-description-remove,#removePortrait):hover{
    color:var(--ui-danger,var(--red))!important;
    background:var(--ui-danger-soft)!important;
    border-color:var(--ui-danger,var(--red))!important;
  }

  #editorView :is(.toolbar,.settings-modal) :is(button,.file-label){
    min-height:32px!important;
    padding:5px 10px!important;
    font-size:11px!important;
    line-height:20px!important;
  }

  #editorView .character-sheet button:not(.collapse-btn):focus-visible,
  #editorView :is(.toolbar,.settings-modal) button:focus-visible,
  #editorView .portrait-actions > label:focus-within{
    outline:2px solid var(--ui-accent)!important;
    outline-offset:-2px!important;
  }

  #editorView .character-sheet button:not(.collapse-btn):disabled,
  #editorView :is(.toolbar,.settings-modal) button:disabled{
    opacity:.45;
    cursor:default;
    pointer-events:none;
  }
}

/* Keep all toolbar actions legible when the campaign shortcut is present. */
@media screen and (max-width:720px){
  #editorView .toolbar{
    grid-template-columns:repeat(6,minmax(0,1fr));
  }
  #editorView .toolbar-title{grid-column:1 / 4;grid-row:1}
  #editorView #viewModeBtn{grid-column:4;grid-row:1}
  #editorView .toolbar-account{grid-column:5;grid-row:1;margin:0}
  #editorView #mobileMenuBtn{grid-column:6;grid-row:1}
  #editorView #charactersBtn{grid-column:1 / 4;grid-row:2}
  #editorView #editorCampaignsBtn{grid-column:4 / 7;grid-row:2}
  #editorView .toolbar > button,
  #editorView .toolbar-account > button{
    width:100%!important;
    min-width:0!important;
    min-height:36px!important;
    padding:4px!important;
  }
  #editorView #mobileMenuBtn{font-size:18px!important}
  #editorView .toolbar-controls :is(button,.file-label){
    min-height:36px!important;
  }
}

/* Inventory actions remain visible without hovering, including on touch screens. */
@media screen{
  #editorView .character-sheet .inventory-name-line{
    grid-template-columns:minmax(0,1fr)!important;
  }
  #editorView .character-sheet .inventory-name-line.has-expand{
    grid-template-columns:30px minmax(0,1fr)!important;
    gap:4px!important;
    align-items:center;
  }
  #editorView .character-sheet .inventory-name-line .item-expand{
    position:static!important;
  }
  #editorView .character-sheet .inventory-name-line .item-expand,
  #editorView .character-sheet .custom-attack-actions .custom-attack-expand,
  #editorView .character-sheet .inventory-section > summary::after,
  #editorView .character-sheet .total-points > summary::after,
  #editorView .settings-help > summary::after{
    width:28px!important;
    height:27px!important;
    min-height:27px!important;
    margin:0 1px!important;
    padding:0!important;
    border:1px solid var(--ui-border-strong,var(--ui-border))!important;
    border-radius:3px!important;
    color:var(--ui-text)!important;
    background:var(--ui-surface-soft)!important;
    font-size:18px!important;
    line-height:23px!important;
  }
  #editorView .character-sheet .inventory-item.is-open > .inventory-main{
    background:color-mix(in srgb,var(--row-stripe-a) 65%,var(--ui-accent-soft))!important;
  }
  #editorView .character-sheet :is(.item-expand,.custom-attack-expand)[aria-expanded="true"],
  #editorView .character-sheet .inventory-section[open] > summary::after,
  #editorView .character-sheet .total-points[open] > summary::after,
  #editorView .settings-help[open] > summary::after{
    border-color:var(--ui-accent)!important;
    background:var(--ui-accent-soft)!important;
  }
  #editorView .character-sheet .inventory-move-actions{
    gap:4px!important;
    padding:1px 3px;
    align-items:center;
  }
  #editorView .character-sheet .inventory-move-actions .item-move-group{
    height:27px;
    gap:3px;
    align-items:stretch;
  }
  #editorView .character-sheet .inventory-move-actions .item-move-group:first-child:not(:only-child){
    flex:0 0 54px;
  }
  #editorView .character-sheet .inventory-move-actions :is(.item-move,.item-move-part){
    height:27px!important;
    min-height:27px!important;
    padding:2px 5px!important;
    border:1px solid var(--ui-border-strong,var(--ui-border))!important;
    border-radius:3px!important;
    background:var(--ui-surface-soft)!important;
    font-weight:700!important;
    overflow:visible;
    text-overflow:clip;
    white-space:nowrap!important;
  }
  #editorView .character-sheet .inventory-move-actions .item-move-part{
    flex:0 0 auto;
  }
  #editorView .character-sheet :is(.item-expand,.custom-attack-expand,.item-move,.item-move-part):hover,
  #editorView .character-sheet .inventory-section > summary:hover::after,
  #editorView .character-sheet .total-points > summary:hover::after,
  #editorView .settings-help > summary:hover::after{
    border-color:var(--ui-accent)!important;
    background:var(--ui-hover)!important;
  }
  #editorView .character-sheet :is(.item-expand,.custom-attack-expand,.item-move,.item-move-part):focus-visible,
  #editorView .character-sheet .inventory-section > summary:focus-visible::after,
  #editorView .character-sheet .total-points > summary:focus-visible::after,
  #editorView .settings-help > summary:focus-visible::after{
    outline:2px solid var(--ui-accent)!important;
    outline-offset:1px;
  }
}

/* Native summaries share the item disclosure appearance. */
@media screen{
  #editorView .character-sheet .inventory-section > summary::after,
  #editorView .character-sheet .total-points > summary::after,
  #editorView .settings-help > summary::after{
    content:"▸";
    right:2px;
    top:50%;
    transform:translateY(-50%);
    box-sizing:border-box;
    display:flex;
    align-items:center;
    justify-content:center;
    font-weight:400;
  }
  #editorView .character-sheet .inventory-section[open] > summary::after,
  #editorView .character-sheet .total-points[open] > summary::after,
  #editorView .settings-help[open] > summary::after{content:"▾"}
}

@media screen{
  #editorView .character-sheet .total-points > summary{
    padding-right:34px!important;
  }
  #editorView .settings-help > summary{
    min-height:35px;
    padding-right:36px;
  }
}

/* Keep attack deletion in a dedicated final column while editing. */
@media screen{
  html:not(.print-mode) #editorView:not(.view-mode) .character-sheet .attack-table .attack-table-row{
    grid-template-columns:var(--attack-table-columns) 30px!important;
  }
  html:not(.print-mode) #editorView:not(.view-mode) .character-sheet .attack-table-melee .attack-table-row{
    min-width:807px;
  }
  #editorView .character-sheet .attack-delete-cell{
    display:flex;
    align-items:center;
    justify-content:center;
  }
  #editorView.view-mode .character-sheet .attack-delete-cell{display:none!important}
}
@media print{
  .character-sheet .attack-delete-cell{display:none!important}
}
html.print-mode .character-sheet .attack-delete-cell{display:none!important}

/* Window dismissal uses one neutral control across every dialog. */
button.dialog-close,
#editorView .settings-modal button.dialog-close{
  box-sizing:border-box;
  display:inline-flex;
  flex:0 0 32px;
  align-items:center;
  justify-content:center;
  width:32px!important;
  min-width:32px!important;
  height:32px!important;
  min-height:32px!important;
  margin:0!important;
  padding:0!important;
  border:1px solid var(--ui-border-strong,var(--ui-border))!important;
  border-radius:0!important;
  color:var(--ui-text)!important;
  background:var(--ui-surface-soft)!important;
  box-shadow:none!important;
  font:400 22px/1 var(--font-ui)!important;
  text-shadow:none;
  cursor:pointer;
}
button.dialog-close:hover,
#editorView .settings-modal button.dialog-close:hover{
  background:var(--ui-hover)!important;
}
button.dialog-close:active,
#editorView .settings-modal button.dialog-close:active{
  background:var(--ui-border)!important;
}
button.dialog-close:focus,
#editorView .settings-modal button.dialog-close:focus{
  outline:2px solid var(--ui-text)!important;
  outline-offset:2px!important;
}
button.dialog-close:disabled,
#editorView .settings-modal button.dialog-close:disabled{
  opacity:.45;
  cursor:default;
  pointer-events:none;
}

/* Shared editing fields follow the traits and skills input style. */
@media screen{
  #editorView:not(.view-mode) .character-sheet :is(.weapon-config-edit,.custom-attack-editor){
    --editor-skill:180px;
    --editor-base:58px;
    --editor-dice:48px;
    --editor-mod:40px;
    --editor-damage-type:68px;
    --editor-reach:54px;
    --editor-parry:86px;
    --editor-parry-mod:52px;
    --editor-result:64px;
    --editor-st:50px;
    --editor-acc:38px;
    --editor-range:120px;
    --editor-rof:54px;
    --editor-shots:80px;
    --editor-bulk:40px;
    --editor-rcl:40px;
    border-radius:0!important;
  }
  #editorView:not(.view-mode) .character-sheet :is(.weapon-profile-edit-row,.custom-editor-grid) :is(input:not([type="checkbox"]),select){
    box-sizing:border-box;
    width:100%!important;
    height:25px!important;
    min-height:25px!important;
    margin:0!important;
    padding:1px 2px!important;
    border:1px solid var(--ui-border)!important;
    border-radius:0!important;
    background:var(--ui-field)!important;
    box-shadow:none!important;
    color:var(--ui-text)!important;
    font:400 11px/1.28 var(--font-ui)!important;
    text-align:left;
  }
  #editorView:not(.view-mode) .character-sheet :is(.weapon-profile-edit-row,.custom-editor-grid) :is(input,select):focus{
    outline:2px solid var(--ui-accent)!important;
    outline-offset:-2px!important;
  }
  #editorView:not(.view-mode) .character-sheet :is(.weapon-profile-edit-row,.custom-editor-grid) .profile-parry-preview{
    box-sizing:border-box;
    height:25px!important;
    min-height:25px!important;
    width:100%;
    display:flex;
    align-items:center;
    justify-content:center;
    margin:0;
    border:1px solid var(--ui-border)!important;
    border-radius:0!important;
    background:var(--ui-accent-soft)!important;
    color:var(--ui-value)!important;
    font:700 11px/1.28 var(--font-ui)!important;
  }
  #editorView:not(.view-mode) .character-sheet .weapon-profile-edit-grid-melee{
    --weapon-profile-edit-columns:48px 86px 125px var(--editor-skill) var(--editor-base) var(--editor-dice) var(--editor-mod) var(--editor-damage-type) var(--editor-reach) var(--editor-parry) var(--editor-parry-mod) var(--editor-result) var(--editor-st) 28px;
  }
  #editorView:not(.view-mode) .character-sheet .weapon-profile-edit-grid-ranged{
    --weapon-profile-edit-columns:48px 86px 125px var(--editor-skill) var(--editor-base) var(--editor-dice) var(--editor-mod) var(--editor-damage-type) var(--editor-acc) var(--editor-range) var(--editor-rof) var(--editor-shots) var(--editor-st) var(--editor-bulk) var(--editor-rcl) 28px;
  }
  #editorView:not(.view-mode) .character-sheet .weapon-profile-edit-grid{
    width:max-content;
    min-width:100%;
  }
  #editorView:not(.view-mode) .character-sheet .weapon-profile-edit-row > .profile-field{
    box-sizing:border-box;
    padding:3px 2px!important;
    align-items:center;
  }
  #editorView:not(.view-mode) .character-sheet :is(.weapon-profile-edit-heading,.custom-editor-grid .profile-field > label){
    box-sizing:border-box;
    height:25px;
    margin:0;
    padding:3px 2px;
    overflow:visible;
    overflow-wrap:normal;
    white-space:nowrap!important;
    font:750 9.5px/19px var(--font-heading)!important;
  }
  #editorView:not(.view-mode) .character-sheet .custom-attack-editor{
    max-width:100%;
    overflow-x:auto;
    overscroll-behavior-inline:contain;
    padding:3px!important;
  }
  #editorView:not(.view-mode) .character-sheet .custom-editor-grid{
    display:flex;
    width:max-content;
    min-width:100%;
    gap:6px;
  }
  #editorView:not(.view-mode) .character-sheet .custom-editor-grid .profile-group{
    flex:0 0 auto;
    padding:0!important;
    margin:0!important;
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
  }
  #editorView:not(.view-mode) .character-sheet .custom-editor-grid .profile-fields{
    display:grid;
    grid-template-columns:var(--editor-skill);
    gap:0!important;
  }
  #editorView:not(.view-mode) .character-sheet .custom-editor-grid .profile-field{
    box-sizing:border-box;
    padding:0 2px;
    grid-column:auto!important;
  }
  #editorView:not(.view-mode) .character-sheet .custom-editor-grid .profile-fields-damage{
    grid-template-columns:var(--editor-base) var(--editor-dice) var(--editor-mod) var(--editor-damage-type);
  }
  #editorView:not(.view-mode) .character-sheet .custom-editor-grid .profile-fields-ranged{
    grid-template-columns:var(--editor-acc) var(--editor-range) var(--editor-rof) var(--editor-shots) var(--editor-bulk) var(--editor-rcl) var(--editor-st);
  }
  #editorView:not(.view-mode) .character-sheet .custom-editor-grid .profile-fields-melee{
    grid-template-columns:var(--editor-reach) var(--editor-parry) var(--editor-parry-mod) var(--editor-result) var(--editor-st);
  }
}
