<section class="npc-main npc-main-{{ifThen isPlayMode 'play' 'edit'}}">
  <fieldset class="regiment-fieldset">

    <div class="npc-pc flexrow">

      <!-- LEFT: portrait -->
      <div class="npc-left">
        <img class="actor-img" src="{{actor.img}}" data-edit="img" data-action="editImage" data-tooltip="{{actor.name}}" />
      </div>

      <!-- RIGHT: name + vitals -->
      <div class="npc-right">
        <div class="character-name">
          {{formInput fields.name value=source.name rootId=partId disabled=isPlayMode}}
          <a class="control" data-action="toggleSheet" data-tooltip="OATHHAMMER.ToggleSheet" data-tooltip-direction="UP">
            <i class="fa-solid fa-user-{{ifThen isPlayMode 'lock' 'pen'}}"></i>
          </a>
        </div>

        <!-- Row 1: combat stats -->
        <div class="npc-vitals-grid regiment-vitals-grid regiment-row1">

          <!-- Grit -->
          <div class="npc-vital npc-vital-grit">
            <span class="vital-label">{{localize "OATHHAMMER.Label.Grit"}}</span>
            <span class="vital-value">
              <a class="grit-btn" data-action="adjustGrit" data-delta="-1" data-tooltip="−1">−</a>
              <input type="number" class="npc-num-input" name="system.grit.value" value="{{system.grit.value}}" min="0" />
              <span class="res-sep">/</span>
              {{formInput systemFields.grit.fields.max value=system.grit.max name="system.grit.max" disabled=isPlayMode}}
              <a class="grit-btn" data-action="adjustGrit" data-delta="1" data-tooltip="+1">+</a>
            </span>
          </div>

          <!-- Armor Dice -->
          <div class="npc-vital">
            <span class="vital-label{{#if isPlayMode}} vital-roll-label{{/if}}"
              {{#if isPlayMode}}data-action="rollArmor" data-tooltip="OATHHAMMER.Tooltip.RollArmor"{{/if}}>
              {{#if isPlayMode}}<i class="fa-solid fa-dice-d6"></i>{{/if}}
              {{localize "OATHHAMMER.Label.ArmorDice"}}
            </span>
            <span class="vital-value">
              <input type="number" class="npc-num-input" name="system.armorDice.value" value="{{system.armorDice.value}}" min="0" {{#if isPlayMode}}disabled{{/if}} />
              {{#if isPlayMode}}
              <span class="npc-color-badge">{{armorDiceEmoji}}</span>
              {{else}}
              <select name="system.armorDice.colorDiceType" class="npc-color-select">
                {{selectOptions colorChoices selected=system.armorDice.colorDiceType}}
              </select>
              {{/if}}
            </span>
          </div>

          <!-- Movement -->
          <div class="npc-vital">
            <span class="vital-label">{{localize "OATHHAMMER.Label.Movement"}}</span>
            <span class="vital-value">
              <input type="number" class="npc-num-input" name="system.movement" value="{{system.movement}}" min="0" {{#if isPlayMode}}disabled{{/if}} />
              <span class="res-sep">ft</span>
            </span>
          </div>

        </div><!-- /row1 -->

        <!-- Row 2: cost stats -->
        <div class="npc-vitals-grid regiment-vitals-grid regiment-row2">

          <!-- Supply Cost -->
          <div class="npc-vital">
            <span class="vital-label">{{localize "OATHHAMMER.Label.SupplyCost"}}</span>
            <span class="vital-value">
              <input type="number" class="npc-num-input" name="system.supplyCost" value="{{system.supplyCost}}" min="0" {{#if isPlayMode}}disabled{{/if}} />
              <span class="res-sep">gp / day</span>
            </span>
          </div>

          <!-- Recruitment Cost -->
          <div class="npc-vital">
            <span class="vital-label">{{localize "OATHHAMMER.Label.RecruitmentCost"}}</span>
            <span class="vital-value">
              <input type="number" class="npc-num-input" name="system.recruitmentCost" value="{{system.recruitmentCost}}" min="0" {{#if isPlayMode}}disabled{{/if}} />
              <span class="res-sep">gp</span>
            </span>
          </div>

          <!-- Mercenary -->
          <div class="npc-vital regiment-mercenary-vital">
            <span class="vital-label">{{localize "OATHHAMMER.Label.Mercenary"}}</span>
            <span class="vital-value">
              {{formInput systemFields.mercenary value=system.mercenary name="system.mercenary" disabled=isPlayMode}}
            </span>
          </div>

        </div><!-- /row2 -->

        <!-- Leader -->
        <div class="regiment-leader-row" data-drop-target="leader">
          <span class="regiment-leader-label">{{localize "OATHHAMMER.Label.UnitLeader"}}</span>
          {{#if leader}}
          <img src="{{leader.img}}" class="regiment-leader-img" />
          <a class="regiment-leader-name" data-action="openLeader" data-tooltip="{{localize 'OATHHAMMER.Tooltip.OpenLeader'}}">{{leader.name}}</a>
          {{#unless isPlayMode}}
          <a class="regiment-leader-clear" data-action="clearLeader" data-tooltip="{{localize 'OATHHAMMER.Tooltip.ClearLeader'}}">
            <i class="fa-solid fa-times"></i>
          </a>
          {{/unless}}
          {{else}}
          <span class="regiment-leader-empty">{{localize "OATHHAMMER.Label.DropLeaderHint"}}</span>
          {{/if}}
        </div>

      </div><!-- /npc-right -->
    </div>
  </fieldset>
</section>
