<form class="{{cssClass}}" autocomplete="off">
  {{! Sheet Header }}
  <header class="sheet-header card clipped-bot {{#if (not is_active)}}inactive-mech{{/if}}">
    <h1 class="name">
      <input
        class="lancer-input"
        name="name"
        type="text"
        value="{{actor.name}}"
        placeholder='{{localize "
        lancer.placeholder.name"}}'
      >
    </h1>
    {{{ref-portrait-img actor.img "img" actor}}}
    <div class="header-details monospace">
      {{#if (not is_active)}}
        {{localize "lancer.mech-sheet.inactive-warning"}}
      {{else}}
        <span>{{localize "TYPES.Actor.pilot"}} :: {{pilot.system.callsign}}<br>
          {{localize "TYPES.Item.frame"}} :: {{itemTypes.frame.0.system.manufacturer}}
          {{itemTypes.frame.0.name}}</span>
      {{/if}}
    </div>

    {{!-- Sheet Tab Navigation --}}
    <nav class="lancer-tabs" data-group="primary">
      <a class="item lancer-tab medium" data-tab="stats">{{localize "lancer.mech-sheet.tabs.stats"}}</a>
      <a class="item lancer-tab medium" data-tab="loadout">{{localize "lancer.mech-sheet.tabs.loadout"}}</a>
      <a class="item lancer-tab medium" data-tab="talents">{{localize "lancer.mech-sheet.tabs.talents"}}</a>
      <a class="item lancer-tab medium" data-tab="effects">{{localize "lancer.common-sheet.tabs.effects"}}</a>
    </nav>
  </header>

  {{!-- Sheet Body --}}
  <section class="sheet-body">
    <div class="tab stats" data-group="primary" data-tab="stats">
      <div class="stat-grid">
        {{{stat-edit-max-card
          "hp" "mdi mdi-heart-outline" "system.hp.value" "system.hp.max"}}}
        {{{stat-edit-max-card "heat" "cci cci-heat" "system.heat.value" "system.heat.max"}}}
        {{{stat-view-card "evasion" "cci cci-evasion" "system.evasion"}}}
        {{{stat-view-card "armor" "mdi mdi-shield-outline" "system.armor"}}}
        {{{stat-edit-max-card "structure" "cci cci-structure" "system.structure.value" "system.structure.max"}}}
        {{{stat-edit-max-card "stress" "cci cci-reactor" "system.stress.value" "system.stress.max"}}}
        {{{stat-view-card "edef" "cci cci-edef" "system.edef"}}}
        {{{stat-view-card "speed" "mdi mdi-arrow-right-bold-hexagon-outline" "system.speed"}}}
        {{{stat-view-card "save" "cci cci-save" "system.save"}}}
        {{{stat-view-card "sensor_range" "cci cci-sensor" "system.sensor_range"}}}
        {{{tech-flow-card "tech_attack" "cci cci-tech-full" "system.tech_attack"}}}
        {{{stat-edit-rollable-card "burn" "cci cci-burn" "system.burn"}}}
        {{{stat-edit-card "overshield" "mdi mdi-shield-star-outline" "system.overshield.value"}}}
        {{{stat-edit-max-card "repairs" "cci cci-repair" "system.repairs.value" "system.repairs.max"}}}
        <div class="size-card">
          {{#if (eq system.size 0.5)}}
            <i class="cci cci-size-half size-icon theme--main"></i>
          {{else}}
            <i class="cci cci-size-{{system.size}} size-icon theme--main"></i>
          {{/if}}
        </div>
        {{{overcharge-button actor "system.overcharge"}}}
        <div class="flexcol card clipped">
          <div class="lancer-header lancer-primary">
            <span class="major">
              {{localize "lancer.mech-sheet.core.label"}}
            </span>
          </div>
          <div class="flexrow stat-container">
            <input
              name="system.core_energy"
              class="core-power-toggle mdi mdi-battery"
              style="margin: auto"
              type="checkbox"
              data-dtype="Boolean"
              {{checked system.core_energy}}
            >
          </div>
        </div>
        {{{stat-rollable-card "grit" "cci cci-armor" "system.grit"}}}
        {{{pilot-slot "system.pilot" value=pilot}}}

        <div class="wraprow double hase">
          {{{stat-rollable-card "hull" "" "system.hull"}}}
          {{{stat-rollable-card "agi" "" "system.agi"}}}
          {{{stat-rollable-card "sys" "" "system.sys"}}}
          {{{stat-rollable-card "eng" "" "system.eng"}}}
        </div>
        <div class="inventory" style="flex: inherit; margin: 3px 10px">
          <button class="lancer-button" type="button" style="padding: 8px 16px">View Inventory</button>
        </div>
      </div>
      <div class="pilot-frame-wrapper flexrow">
        <div class="card">
          <span class="lancer-header lancer-primary submajor clipped-top">
            {{localize "lancer.mech-sheet.macros.label"}}
          </span>
          <div class="lancer-flow-button-grid">
            {{{flow-button (localize "lancer.common-sheet.buttons.stabilize") "Stabilize"}}}
            {{{flow-button (localize "lancer.common-sheet.buttons.fullRepair") "FullRepair"}}}
            <div style="margin: 0px 8px; border-left: 2px solid #a2a2a2"></div>
            {{{flow-button (localize "lancer.common-sheet.buttons.structure") "Structure"}}}
            {{{flow-button (localize "lancer.common-sheet.buttons.overheat") "Overheat"}}}
          </div>
        </div>
        {{#if (is-combatant actor)}}
          <div style="min-width: 560px" class="card">
            <span class="lancer-header lancer-primary submajor clipped-top">
              {{localize "lancer.mech-sheet.actions.label"}}
            </span>
            <div class="lancer-flow-button-grid">
              {{{action-button "Protocol" "system.action_tracker.protocol" "protocol"}}}
              {{{action-button "Movement" "system.action_tracker.move" "move"}}}
              {{{action-button "Full Action" "system.action_tracker.full" "full"}}}
              {{{action-button "Quick Action" "system.action_tracker.quick" "quick"}}}
              {{{action-button "Reaction" "system.action_tracker.reaction" "reaction"}}}
            </div>
          </div>
        {{/if}}
      </div>
    </div>

    <div class="tab loadout" data-group="primary" data-tab="loadout">
      {{{mech-frame "system.loadout.frame.value" system.core_energy}}}
      <div class="card clipped">
        <span class="lancer-header lancer-primary submajor">{{
            localize "lancer.common-sheet.headers.combatUtilities"
          }}</span>
        <div class="lancer-flow-button-grid">
          {{{flow-button (localize "lancer.common-sheet.buttons.scan") "Scan"}}}
          {{{flow-button (localize "lancer.common-sheet.buttons.basicAttack") "BasicAttack"}}}
          {{{flow-button (localize "lancer.common-sheet.buttons.damage") "Damage"}}}
          {{{flow-button (localize "lancer.common-sheet.buttons.tech") "TechAttack"}}}
        </div>
      </div>
      <div class="card">
        <div class="lancer-header lancer-primary major">
          <span>
            {{{localize "lancer.mech-sheet.system.label"}}}
          </span>
          <span style="flex-grow: 0">
            <i class="cci cci-system-point i--4"></i>
            {{system.loadout.sp.value}} / {{system.loadout.sp.max}}
            {{localize "lancer.mech-sheet.system.sp-used"}}
          </span>
        </div>
        {{{mech-loadout}}}
      </div>
    </div>

    <div class="tab talents" data-group="primary" data-tab="talents">
      {{!-- Talents --}}
      {{#if system.pilot.value}}
        <div class="card clipped">
          <h2 class="lancer-header lancer-primary major clipped">
            {{localize "lancer.pilot-sheet.abilities.talents"}}
          </h2>
          {{#each system.pilot.value.itemTypes.talent as |talent index|}}
            {{{item-preview (concat "system.pilot.value.itemTypes.talent." index) null}}}
          {{/each}}
        </div>
      {{/if}}
    </div>

    <div class="tab effects" data-group="primary" data-tab="effects">
      {{{effect-categories-view actor effect_categories}}}
    </div>
  </section>
</form>
