<section class="tab-panel {{tab.cssClass}}">
  <div class="resource-bar resource-bar-equipment">
    <div class="resource-box resource-box-single resource-box-compact resource-box-inline resource-box-inline-single {{#if system.overloaded}}resource-box-overloaded{{/if}}">
      <label class="resource-label-accent">{{localize "MGNE.Character.Load"}}</label>
      <div class="numeric-pill">
        <span class="numeric-input numeric-input-readonly load-display {{#if system.overloaded}}load-overloaded{{/if}}"
              title="{{system.lightItemCount}} light items (10 = 1 slot){{#if system.heavyItemCount}} · {{system.heavyItemCount}} heavy{{/if}}">
          {{system.currentLoad}} / {{system.carryCapacity}}
        </span>
      </div>
    </div>
    <div class="resource-box resource-box-single resource-box-compact resource-box-inline resource-box-inline-single">
      <label class="resource-label-accent">{{localize "MGNE.Character.Rations"}}</label>
      <div class="numeric-pill">
        <input class="numeric-input" type="number" name="system.rations" value="{{source.system.rations}}" min="0" />
      </div>
    </div>
    <div class="resource-box resource-box-single resource-box-compact resource-box-inline resource-box-inline-single">
      <label class="resource-label-accent">{{localize "MGNE.Character.Kiffol"}}</label>
      <div class="numeric-pill numeric-pill-suffix">
        <input class="numeric-input" type="number" name="system.kiffol" value="{{source.system.kiffol}}" min="0" />
        <span class="numeric-suffix">₵</span>
      </div>
    </div>
  </div>

  <div class="inventory-section">
    <div class="inventory-header">
      <h3>{{localize "MGNE.Character.Weapons"}}</h3>
      <button type="button" data-action="createItem" data-item-type="weapon">{{localize "MGNE.Character.AddWeapon"}}</button>
    </div>
    {{#each weapons}}
      <div class="item-row {{#if system.broken}}item-row-broken{{/if}}" data-item-id="{{id}}">
        <div class="item-name" {{#if tooltip}}data-tooltip="{{tooltip}}" data-tooltip-class="mgne-item-tooltip"{{/if}}>
          {{name}}{{#if system.broken}} <span class="item-broken-badge">{{localize "MGNE.Common.Broken"}}</span>{{/if}}
          {{#each system.properties}}<span class="weapon-property-badge" data-tooltip="{{lookup @root.config.weaponPropertyHints this}}">{{lookup @root.config.weaponPropertyLabels this}}</span>{{/each}}
        </div>
        <div>{{system.damage}}</div>
        <div>{{lookup @root.config.weaponCategories system.category}}</div>
        <span class="item-weight-badge weight-{{system.weight}}">{{lookup @root.config.weightCategories system.weight}}</span>
        <span class="item-durability-badge {{#if system.broken}}durability-broken{{/if}}">
          <i class="fa-solid fa-shield-halved"></i> {{system.durabilityDie}}
        </span>
        <div class="item-actions">
          <button type="button" data-action="toggleEquipped">{{#if system.equipped}}{{localize "MGNE.Common.Unequip"}}{{else}}{{localize "MGNE.Common.Equip"}}{{/if}}</button>
          <button type="button" class="rollable" data-roll-type="weapon">{{localize "MGNE.Common.Attack"}}</button>
          <button type="button" class="rollable" data-roll-type="damage">{{localize "MGNE.Common.Damage"}}</button>
          <button type="button" class="rollable" data-roll-type="durability" data-tooltip="{{localize "MGNE.Common.RollDurability"}}">{{localize "MGNE.Common.Durability"}}</button>
          <button type="button" class="rollable" data-roll-type="usage">{{localize "MGNE.Common.Usage"}}</button>
          <button type="button" data-action="editItem">{{localize "MGNE.Common.Edit"}}</button>
          <button type="button" data-action="deleteItem">{{localize "MGNE.Common.Delete"}}</button>
        </div>
      </div>
    {{else}}
      <p class="empty-state">{{localize "MGNE.Empty.NoWeapons"}}</p>
    {{/each}}
  </div>

  <div class="inventory-section">
    <div class="inventory-header">
      <h3>{{localize "MGNE.Character.Armor"}}</h3>
      <button type="button" data-action="createItem" data-item-type="armor">{{localize "MGNE.Character.AddArmor"}}</button>
      <button type="button" data-action="createItem" data-item-type="shield">{{localize "MGNE.Character.AddShield"}}</button>
    </div>
    {{#each armors}}
      <div class="item-row {{#if system.broken}}item-row-broken{{/if}}" data-item-id="{{id}}">
        <div class="item-name" {{#if tooltip}}data-tooltip="{{tooltip}}" data-tooltip-class="mgne-item-tooltip"{{/if}}>
          {{name}}{{#if system.broken}} <span class="item-broken-badge">{{localize "MGNE.Common.Broken"}}</span>{{/if}}
        </div>
        <div>{{system.armorDie}}</div>
        <div>{{localize "MGNE.Common.Penalty"}} {{system.penalty}}</div>
        <span class="item-weight-badge weight-{{system.weight}}">{{lookup @root.config.weightCategories system.weight}}</span>
        <span class="item-durability-badge {{#if system.broken}}durability-broken{{/if}}"><i class="fa-solid fa-shield-halved"></i> {{system.durabilityDie}}</span>
        <div class="item-actions">
          <button type="button" data-action="toggleEquipped">{{#if system.equipped}}{{localize "MGNE.Common.Unequip"}}{{else}}{{localize "MGNE.Common.Equip"}}{{/if}}</button>
          <button type="button" class="rollable" data-roll-type="durability">{{localize "MGNE.Common.Durability"}}</button>
          <button type="button" data-action="editItem">{{localize "MGNE.Common.Edit"}}</button>
          <button type="button" data-action="deleteItem">{{localize "MGNE.Common.Delete"}}</button>
        </div>
      </div>
    {{/each}}
    {{#each shields}}
      <div class="item-row {{#if system.broken}}item-row-broken{{/if}}" data-item-id="{{id}}">
        <div class="item-name" {{#if tooltip}}data-tooltip="{{tooltip}}" data-tooltip-class="mgne-item-tooltip"{{/if}}>
          {{name}}{{#if system.broken}} <span class="item-broken-badge">{{localize "MGNE.Common.Broken"}}</span>{{/if}}
        </div>
        <div>{{system.armorDie}}</div>
        <div>{{localize "MGNE.ItemTypes.shield"}}</div>
        <span class="item-weight-badge weight-{{system.weight}}">{{lookup @root.config.weightCategories system.weight}}</span>
        <span class="item-durability-badge {{#if system.broken}}durability-broken{{/if}}"><i class="fa-solid fa-shield-halved"></i> {{system.durabilityDie}}</span>
        <div class="item-actions">
          <button type="button" data-action="toggleEquipped">{{#if system.equipped}}{{localize "MGNE.Common.Unequip"}}{{else}}{{localize "MGNE.Common.Equip"}}{{/if}}</button>
          <button type="button" class="rollable" data-roll-type="durability">{{localize "MGNE.Common.Durability"}}</button>
          <button type="button" data-action="editItem">{{localize "MGNE.Common.Edit"}}</button>
          <button type="button" data-action="deleteItem">{{localize "MGNE.Common.Delete"}}</button>
        </div>
      </div>
    {{/each}}
  </div>

  <div class="inventory-section">
    <div class="inventory-header">
      <h3>{{localize "MGNE.ItemTypes.equipment"}}</h3>
      <button type="button" data-action="createItem" data-item-type="equipment">{{localize "MGNE.Character.AddEquipment"}}</button>
    </div>
    {{#each equipmentItems}}
      <div class="item-row {{#if system.broken}}item-row-broken{{/if}}" data-item-id="{{id}}">
        <div class="item-name" {{#if tooltip}}data-tooltip="{{tooltip}}" data-tooltip-class="mgne-item-tooltip"{{/if}}>
          {{name}}{{#if system.broken}} <span class="item-broken-badge">{{localize "MGNE.Common.Broken"}}</span>{{/if}}
        </div>
        <div>{{localize "MGNE.Common.QuantityShort"}} {{system.quantity}}</div>
        <div>{{system.usageDie}}</div>
        <span class="item-weight-badge weight-{{system.weight}}">{{lookup @root.config.weightCategories system.weight}}</span>
        <span class="item-durability-badge {{#if system.broken}}durability-broken{{/if}}"><i class="fa-solid fa-shield-halved"></i> {{system.durabilityDie}}</span>
        <div class="item-actions">
          <button type="button" class="rollable" data-roll-type="durability">{{localize "MGNE.Common.Durability"}}</button>
          <button type="button" class="rollable" data-roll-type="usage">{{localize "MGNE.Common.Usage"}}</button>
          <button type="button" data-action="editItem">{{localize "MGNE.Common.Edit"}}</button>
          <button type="button" data-action="deleteItem">{{localize "MGNE.Common.Delete"}}</button>
        </div>
      </div>
    {{else}}
      <p class="empty-state">{{localize "MGNE.Empty.NoEquipment"}}</p>
    {{/each}}
  </div>

  <div class="inventory-section">
    <div class="inventory-header">
      <h3>{{localize "MGNE.Character.ResonanceCores"}}</h3>
      <button type="button" data-action="createItem" data-item-type="resonance-core">{{localize "MGNE.Character.AddCore"}}</button>
    </div>
    {{#each cores}}
      <div class="item-row {{#if system.broken}}item-row-broken{{/if}}" data-item-id="{{id}}">
        <div class="item-name" {{#if tooltip}}data-tooltip="{{tooltip}}" data-tooltip-class="mgne-item-tooltip"{{/if}}>
          {{name}}{{#if system.broken}} <span class="item-broken-badge">{{localize "MGNE.Common.Broken"}}</span>{{/if}}
          {{#if system.burnedOut}} <span class="item-broken-badge item-burned-badge">{{localize "MGNE.Common.BurnedOut"}}</span>{{/if}}
        </div>
        <div>{{lookup @root.config.resonanceList system.resonationId}}</div>
        <div>{{system.usageDie}}</div>
        <span class="item-weight-badge weight-{{system.weight}}">{{lookup @root.config.weightCategories system.weight}}</span>
        <span class="item-durability-badge {{#if system.broken}}durability-broken{{/if}}"><i class="fa-solid fa-shield-halved"></i> {{system.durabilityDie}}</span>
        <div class="item-actions">
          <button type="button" class="rollable" data-roll-type="resonation">{{localize "MGNE.Common.Invoke"}}</button>
          <button type="button" class="rollable" data-roll-type="durability">{{localize "MGNE.Common.Durability"}}</button>
          <button type="button" class="rollable" data-roll-type="usage">{{localize "MGNE.Common.Usage"}}</button>
          <button type="button" data-action="editItem">{{localize "MGNE.Common.Edit"}}</button>
          <button type="button" data-action="deleteItem">{{localize "MGNE.Common.Delete"}}</button>
        </div>
      </div>
    {{else}}
      <p class="empty-state">{{localize "MGNE.Empty.NoResonanceCores"}}</p>
    {{/each}}
  </div>

  <div class="inventory-section">
    <div class="inventory-header">
      <h3>{{localize "MGNE.Character.Artifacts"}}</h3>
      <button type="button" data-action="createItem" data-item-type="artifact">{{localize "MGNE.Character.AddArtifact"}}</button>
    </div>
    {{#each artifacts}}
      <div class="item-row {{#if system.broken}}item-row-broken{{/if}}" data-item-id="{{id}}">
        <div class="item-name" {{#if tooltip}}data-tooltip="{{tooltip}}" data-tooltip-class="mgne-item-tooltip"{{/if}}>
          {{name}}{{#if system.broken}} <span class="item-broken-badge">{{localize "MGNE.Common.Broken"}}</span>{{/if}}
        </div>
        <div>{{#if system.synchronized}}{{localize "MGNE.Common.Synchronized"}}{{else}}{{localize "MGNE.Common.Unsynchronized"}}{{/if}}</div>
        <div>{{system.usageDie}}</div>
        <span class="item-weight-badge weight-{{system.weight}}">{{lookup @root.config.weightCategories system.weight}}</span>
        <span class="item-durability-badge {{#if system.broken}}durability-broken{{/if}}"><i class="fa-solid fa-shield-halved"></i> {{system.durabilityDie}}</span>
        <div class="item-actions">
          <button type="button" data-action="syncArtifact">{{#if system.synchronized}}{{localize "MGNE.Common.Desync"}}{{else}}{{localize "MGNE.Common.Sync"}}{{/if}}</button>
          <button type="button" class="rollable" data-roll-type="durability">{{localize "MGNE.Common.Durability"}}</button>
          <button type="button" class="rollable" data-roll-type="usage">{{localize "MGNE.Common.Usage"}}</button>
          <button type="button" data-action="editItem">{{localize "MGNE.Common.Edit"}}</button>
          <button type="button" data-action="deleteItem">{{localize "MGNE.Common.Delete"}}</button>
        </div>
      </div>
    {{else}}
      <p class="empty-state">{{localize "MGNE.Empty.NoArtifacts"}}</p>
    {{/each}}
  </div>
</section>
